Találtam benen rejtett cuccokat, csak nemtom ezek mire vannak, nekem nemcsináltak semmit.
[pawn]
SetNPCVehicleSiren(NPC:npcid,state);
GetNPCVehicleSiren(NPC:npcid);
SetVehicleUnique( float ertek )
[/pawn]
E: SetVehicleUnique-vel egy egyedi paramétert lehet megadni/lekérni a jármû struktúrának, jelenleg ezt próbálom elérhetõvé tenni.Megpróbáltam a struktúrás cuccokat kiszedni, addig eljutotttam, hogy átraktam egy másik pluginba, már csak ott a baj, hogy hogyan rendelem hozzá a vID-t a függvényhez.
Ha ez valakit érdekel:
[pawn]
//----------------------------------------------------------
//
// Based on PointToPoint plugin by: Blacklite and <__Ethan__>
// Functions copyed for CNPC Plugin. By Alex009 and new adresses (0.3c) found by: m0niSx
//
//----------------------------------------------------------
#include \"math.h\"
#include <stdio.h>
#include <stddef.h>
#include \"windows.h\"
#include \"SDK/amx/amx.h\"
#include \"SDK/plugincommon.h\"
//----------------------------------------------------------
// AMX Default
typedef void (*logprintf_t)(char* format, ...);
logprintf_t logprintf;
void **ppPluginData;
extern void *pAMXFunctions;
#define PLUGIN_FUNCTION static cell AMX_NATIVE_CALL
#pragma pack(1)
struct InCarSync // 0x86 - 0xC5
{
WORD VehicleId; // 0x86 - 0x0
WORD KeysLR; // 0x88 - 0x2
WORD KeysUD; // 0x8A - 0x4
WORD KeysOther; // 0x8C - 0x6
FLOAT QuaternionScal; // 0x8E - 0x8
FLOAT QuaternionX; // 0x92 - 0xC
FLOAT QuaternionY; // 0x96 - 0x10
FLOAT QuaternionZ; // 0x9A - 0x14
FLOAT PosX; // 0x9E - 0x18
FLOAT PosY; // 0xA2 - 0x1C
FLOAT PosZ; // 0xA6 - 0x20
FLOAT VelocityX; // 0xAA - 0x24
FLOAT VelocityY; // 0xAE - 0x28
FLOAT VelocityZ; // 0xB2 - 0x2C
FLOAT Health; // 0xB6 - 0x30
BYTE PlayerHealth; // 0xBA - 0x34
BYTE PlayerArmour; // 0xBB - 0x35
BYTE PlayerWeapon; // 0xBC - 0x36
BYTE SirenState; // 0xBD - 0x37
BYTE Unknown2; // 0xBE - 0x38
WORD TrailerId; // 0xBF - 0x39
FLOAT Unique; // 0xC1 - 0x3B
};
// Offsets
#define C_SAMP_PLAYERS_OFFSET 0x4
#define C_SAMP_VEHICLES_OFFSET 0x8
//
#define C_PLAYERS_PLAYER_OFFSET 0x7D0
#define C_VEHICLES_VEHICLE_OFFSET 0x1F40
//
// R2
#define R2_C_PLAYER_POS_X_OFFSET 0x0
#define R2_C_PLAYER_POS_Y_OFFSET 0x4
#define R2_C_PLAYER_POS_Z_OFFSET 0x8
#define R2_C_PLAYER_HEALTH_OFFSET 0xC
#define R2_C_PLAYER_ARMOUR_OFFSET 0x10
#define R2_C_PLAYER_ANGLE_OFFSET 0x24
#define R2_C_PLAYER_SYNC_TYPE_OFFSET 0x3E
#define R2_C_PLAYER_FOOT_SYNC_OFFSET 0x42
#define R2_C_PLAYER_INCAR_SYNC_OFFSET 0x86
#define R2_C_PLAYER_PASSANGER_SYNC_OFFSET 0xC5
#define R2_C_PLAYER_AIM_SYNC_OFFSET 0xDD
#define R2_C_PLAYER_AIM_SYNC_STATE_OFFSET 0x275
#define R2_C_PLAYER_STATE_OFFSET 0x281
#define R2_C_PLAYER_IS_STREAMED_OFFSET 0x2BB
#define R2_C_PLAYER_WEAPON_SKILL_OFFSET 0x1A37
#define R2_C_PLAYER_SKIN_OFFSET 0x296 //0x1986
#define R2_C_PLAYER_VEHICLE_ID_OFFSET 0x1A86
#define R2_C_PLAYER_VEHICLE_SEAT_OFFSET 0x1A85
#define R2_C_PLAYER_INTERIOR_OFFSET 0x1A88
#define R2_C_PLAYER_PLAYBACK_FILE 0x1A20
//
#define R2_C_VEHICLE_POS_X_OFFSET 0x0
#define R2_C_VEHICLE_POS_Y_OFFSET 0x4
#define R2_C_VEHICLE_POS_Z_OFFSET 0x8
#define R2_C_VEHICLE_DRIVER_OFFSET 0x6A
#define R2_C_VEHICLE_MODEL_OFFSET 0x82
#define R2_C_VEHICLE_HEALTH_OFFSET 0xA6
// Adresses
#define TEST_ADDR_1 0x479590
#define TEST_ADDR_2 0x46E75A
#define R2_DATA_1 0x50
#define R2_DATA_2 0x89
// structs address
// R2
#define R2_C_SAMP_STRUCTURE 0x4F5268
// fuctions address
// R2
#define R2_CLIENT_CONNECT 0x47C750
#define R2_CLIENT_DISCONNECT 0x47CA50
#define R2_SPAWN_FOR_WORLD 0x494390
#define R2_KILL_FOR_WORLD 0x4920E0
#define R2_SET_SPAWN_INFO 0x491110
#define R2_SET_SKIN 0x48ABA0
#define R2_SET_WEAPON_SKILL 0x4899C0
// logging pointers
#define R2_JOIN_POINTER 0x47C9C4
#define R2_PART_POINTER 0x47CBC8
#define SAMP_VERSION_032 1
// main vars
DWORD c_samp;
DWORD c_players;
DWORD c_vehicles;
DWORD CSampPointer;
// remote procedures pointers
DWORD CPlayerPosXOffset;
DWORD CPlayerPosYOffset;
DWORD CPlayerPosZOffset;
DWORD CPlayerHealthOffset;
DWORD CPlayerArmourOffset;
DWORD CPlayerAngleOffset;
DWORD CPlayerStateOffset;
DWORD CPlayerFootSyncOffset;
DWORD CPlayerInCarSyncOffset;
DWORD CPlayerPassangerSyncOffset;
DWORD CPlayerAimSyncOffset;
DWORD CPlayerAimSyncStateOffset;
DWORD CPlayerSyncTypeOffset;
DWORD CPlayerWeaponSkillOffset;
DWORD CPlayerSkinOffset;
DWORD CPlayerInteriorOffset;
DWORD CPlayerIsStreamedOffset;
DWORD CPlayerVehicleIdOffset;
DWORD CPlayerVehicleSeatOffset;
DWORD CVehiclePosXOffset;
DWORD CVehiclePosYOffset;
DWORD CVehiclePosZOffset;
DWORD CVehicleDriverOffset;
DWORD CVehicleModelOffset;
DWORD CVehicleHealthOffset;
DWORD c_player_struct;
bool Unlock(void *address, int len)
{
#ifdef WIN32
DWORD
oldp;
// Shut up the warnings
return !!VirtualProtect(address, len, PAGE_EXECUTE_READWRITE, &oldp);
#else
return !mprotect((void*)(((int)address / PAGESIZE) * PAGESIZE), PAGESIZE, PROT_WRITE | PROT_READ | PROT_EXEC);
#endif
}
#define POINTER_TO_MEMBER(m,n,o) temp = n, m = *(o *)&temp
void HooksInstall(int version)
{
// addr
void *temp;
switch(version)
{
case SAMP_VERSION_032:
{
/*
POINTER_TO_MEMBER(ClientConnectPointer,(void *)(R2_CLIENT_CONNECT),f_ClientConnect);
POINTER_TO_MEMBER(ClientDisconnectPointer,(void *)(R2_CLIENT_DISCONNECT),f_ClientDisconnect);
POINTER_TO_MEMBER(SpawnForWorldPointer,(void *)(R2_SPAWN_FOR_WORLD),f_SpawnForWorld);
POINTER_TO_MEMBER(SetSpawnInfoPointer,(void *)(R2_SET_SPAWN_INFO),f_SetSpawnInfoPointer);
POINTER_TO_MEMBER(SetSkinPointer,(void *)(R2_SET_SKIN),f_SetSkinPointer);
POINTER_TO_MEMBER(KillForWorldPointer,(void *)(R2_KILL_FOR_WORLD),f_KillForWorld);
POINTER_TO_MEMBER(SetWeaponSkillPointer,(void *)(R2_SET_WEAPON_SKILL),f_SetWeaponSkill);
*/
POINTER_TO_MEMBER(CPlayerPosXOffset,(void *)(R2_C_PLAYER_POS_X_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerPosYOffset,(void *)(R2_C_PLAYER_POS_Y_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerPosZOffset,(void *)(R2_C_PLAYER_POS_Z_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerHealthOffset,(void *)(R2_C_PLAYER_HEALTH_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerArmourOffset,(void *)(R2_C_PLAYER_ARMOUR_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerAngleOffset,(void *)(R2_C_PLAYER_ANGLE_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerStateOffset,(void *)(R2_C_PLAYER_STATE_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerFootSyncOffset,(void *)(R2_C_PLAYER_FOOT_SYNC_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerInCarSyncOffset,(void *)(R2_C_PLAYER_INCAR_SYNC_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerPassangerSyncOffset,(void *)(R2_C_PLAYER_PASSANGER_SYNC_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerAimSyncOffset,(void *)(R2_C_PLAYER_AIM_SYNC_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerAimSyncStateOffset,(void *)(R2_C_PLAYER_AIM_SYNC_STATE_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerSyncTypeOffset,(void *)(R2_C_PLAYER_SYNC_TYPE_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerWeaponSkillOffset,(void *)(R2_C_PLAYER_WEAPON_SKILL_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerSkinOffset,(void *)(R2_C_PLAYER_SKIN_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerInteriorOffset,(void *)(R2_C_PLAYER_INTERIOR_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerIsStreamedOffset,(void *)(R2_C_PLAYER_IS_STREAMED_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerVehicleIdOffset,(void *)(R2_C_PLAYER_VEHICLE_ID_OFFSET),DWORD);
POINTER_TO_MEMBER(CPlayerVehicleSeatOffset,(void *)(R2_C_PLAYER_VEHICLE_SEAT_OFFSET),DWORD);
POINTER_TO_MEMBER(CVehiclePosXOffset,(void *)(R2_C_VEHICLE_POS_X_OFFSET),DWORD);
POINTER_TO_MEMBER(CVehiclePosYOffset,(void *)(R2_C_VEHICLE_POS_Y_OFFSET),DWORD);
POINTER_TO_MEMBER(CVehiclePosZOffset,(void *)(R2_C_VEHICLE_POS_Z_OFFSET),DWORD);
POINTER_TO_MEMBER(CVehicleDriverOffset,(void *)(R2_C_VEHICLE_DRIVER_OFFSET),DWORD);
POINTER_TO_MEMBER(CVehicleModelOffset,(void *)(R2_C_VEHICLE_MODEL_OFFSET),DWORD);
POINTER_TO_MEMBER(CVehicleHealthOffset,(void *)(R2_C_VEHICLE_HEALTH_OFFSET),DWORD);
/*
POINTER_TO_MEMBER(LoggingJoinPointer,(void *)(R2_JOIN_POINTER),DWORD);
POINTER_TO_MEMBER(LoggingPartPointer,(void *)(R2_PART_POINTER),DWORD);
*/
break;
}
}
}
// Functions
void SetVehicleQuaternion(float x,float y,float z,float s)
{
*(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionX)) = x;
*(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionY)) = y;
*(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionZ)) = z;
*(FLOAT*)(c_player_struct + CPlayerInCarSyncOffset + offsetof(InCarSync,QuaternionScal)) = s;
}
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports()
{
return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES;
}
PLUGIN_EXPORT bool PLUGIN_CALL Load( void **ppData )
{
Unlock((void*)0x401000,0xF0844);
pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];
logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF];
logprintf( \" PointToPoint Plugin Loaded.\" );
return true;
}
PLUGIN_EXPORT void PLUGIN_CALL Unload( )
{
logprintf( \"PointToPoint Plugin Unloaded.\" );
}
//----------------------------------------------------------
PLUGIN_FUNCTION n_SetVehicleQuaternion( AMX* amx, cell* params )
{
SetVehicleQuaternion(amx_ctof(params[1]), amx_ctof(params[2]), amx_ctof(params[3]), amx_ctof(params[4]));
return 1;
}
//----------------------------------------------------------
AMX_NATIVE_INFO HelloWorldNatives[ ] =
{
{ \"SetVehicleQuaternion\", n_SetVehicleQuaternion },
{ 0, 0 }
};
PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx )
{
c_samp = *(DWORD*)(CSampPointer);
c_players = *(DWORD*)(c_samp + C_SAMP_PLAYERS_OFFSET);
c_vehicles = *(DWORD*)(c_samp + C_SAMP_VEHICLES_OFFSET);
return amx_Register( amx, HelloWorldNatives, -1 );
}
PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx )
{
return AMX_ERR_NONE;
}
[/pawn]