Added 2 of 3 new offsets for amd64

This commit is contained in:
Johnny Bergström 2004-09-27 10:54:41 +00:00
parent c16eab09ec
commit cfe36dea52
2 changed files with 51 additions and 3 deletions

View File

@ -1474,6 +1474,46 @@ static cell AMX_NATIVE_CALL cs_get_user_driving(AMX *amx, cell *params) // cs_ge
return *((int *)pPlayer->pvPrivateData + OFFSET_ISDRIVING); return *((int *)pPlayer->pvPrivateData + OFFSET_ISDRIVING);
} }
static cell AMX_NATIVE_CALL cs_get_user_stationary(AMX *amx, cell *params) // cs_get_user_stationary(index); = 1 param
{
// Returns 1 if client is using a stationary guns (maybe also other stuff)
// Check player
if (!MF_IsPlayerIngame(params[1]))
{
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
return 0;
}
// Make into edict pointer
edict_t *pPlayer = INDEXENT(params[1]);
// Check entity validity
if (FNullEnt(pPlayer)) {
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
return 0;
}
// If player driving, return 1, if not, return 0
#if !defined __amd64__
return *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY);
#else
// The 32 bit server return 0 and 1 by itself from this offset, but the amd64 server has 2 and 3 respectively
// Doing a simple checking of these defined constants here, and mapping to 0 and 1, to keep our plugin authors sane.
// If an unexpected value is encountered, this will be logged.
if (AMD64_STATIONARY_NO == *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY))
return 0;
else if (AMD64_STATIONARY_YES == *((int *)pPlayer->pvPrivateData + OFFSET_STATIONARY))
return 1;
else {
MF_RaiseAmxError(amx, AMX_ERR_NATIVE);
MF_Log("Unexpected value at offset. Please report this to development team @ www.amxmodx.org!");
return 0;
}
#endif
}
AMX_NATIVE_INFO cstrike_Exports[] = { AMX_NATIVE_INFO cstrike_Exports[] = {
{"cs_set_user_money", cs_set_user_money}, {"cs_set_user_money", cs_set_user_money},
{"cs_get_user_money", cs_get_user_money}, {"cs_get_user_money", cs_get_user_money},
@ -1511,6 +1551,7 @@ AMX_NATIVE_INFO cstrike_Exports[] = {
{"cs_get_user_tked", cs_get_user_tked}, {"cs_get_user_tked", cs_get_user_tked},
{"cs_set_user_tked", cs_set_user_tked}, {"cs_set_user_tked", cs_set_user_tked},
{"cs_get_user_driving", cs_get_user_driving}, {"cs_get_user_driving", cs_get_user_driving},
{"cs_get_user_stationary", cs_get_user_stationary},
//------------------- <-- max 19 characters! //------------------- <-- max 19 characters!
{NULL, NULL} {NULL, NULL}
}; };

View File

@ -34,6 +34,8 @@
// cstrike MODULE TO DO HERE: http://www.amxmodx.org/forums/viewtopic.php?t=45 // cstrike MODULE TO DO HERE: http://www.amxmodx.org/forums/viewtopic.php?t=45
// This implementation uses Vexd's way (lightly modified) of setting models on players. // This implementation uses Vexd's way (lightly modified) of setting models on players.
#define __amd64__
#include <extdll.h> #include <extdll.h>
#include <meta_api.h> #include <meta_api.h>
#include "amxxmodule.h" #include "amxxmodule.h"
@ -63,6 +65,7 @@
#define OFFSET_TK 216 + EXTRAOFFSET // 040926 #define OFFSET_TK 216 + EXTRAOFFSET // 040926
#define OFFSET_BUYZONE 235 + EXTRAOFFSET #define OFFSET_BUYZONE 235 + EXTRAOFFSET
#define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926 #define OFFSET_ISDRIVING 350 + EXTRAOFFSET // 040926
#define OFFSET_STATIONARY 362 + EXTRAOFFSET // 040927 (363 works also!)
#define OFFSET_AWM_AMMO 382 + EXTRAOFFSET #define OFFSET_AWM_AMMO 382 + EXTRAOFFSET
#define OFFSET_SCOUT_AMMO 383 + EXTRAOFFSET #define OFFSET_SCOUT_AMMO 383 + EXTRAOFFSET
@ -96,9 +99,10 @@
#define OFFSET_NVGOGGLES 155 + EXTRAOFFSET // +26 #define OFFSET_NVGOGGLES 155 + EXTRAOFFSET // +26
#define OFFSET_DEFUSE_PLANT 219 + EXTRAOFFSET // +26 #define OFFSET_DEFUSE_PLANT 219 + EXTRAOFFSET // +26
#define OFFSET_VIP 242 + EXTRAOFFSET // +27 #define OFFSET_VIP 242 + EXTRAOFFSET // +27
#define OFFSET_TK å2äA;;#ÖAwä3ä2åa3ÖÄ2e;;åöA"Å! 1ö ÅÄ3åA"Ö <-- this needs to be researched for amd64 ;-) (likely +27 though!) #define OFFSET_TK å // <-- this needs to be researched for amd64 ;-) (likely +27 though!)
#define OFFSET_BUYZONE 268 + EXTRAOFFSET // +27 #define OFFSET_BUYZONE 268 + EXTRAOFFSET // +27
#define OFFSET_ISDRIVING å2äA#ÖAw;;ä3ä2åa3ÖÄ2eåöA;;"Å! 1ö ÅÄ3åA"Ö <-- this needs to be researched for amd64 ;-) #define OFFSET_ISDRIVING 386 + EXTRAOFFSET // 040927
#define OFFSET_STATIONARY 400 + EXTRAOFFSET // 040927 (401 works also)
#define OFFSET_AWM_AMMO 426 + EXTRAOFFSET // +44 #define OFFSET_AWM_AMMO 426 + EXTRAOFFSET // +44
#define OFFSET_SCOUT_AMMO 427 + EXTRAOFFSET // +44 #define OFFSET_SCOUT_AMMO 427 + EXTRAOFFSET // +44
@ -121,7 +125,7 @@
#define OFFSET_CLIPAMMO 65 + EXTRAOFFSET // +14 #define OFFSET_CLIPAMMO 65 + EXTRAOFFSET // +14
#define OFFSET_SILENCER_FIREMODE 88 + EXTRAOFFSET // +14 #define OFFSET_SILENCER_FIREMODE 88 + EXTRAOFFSET // +14
// "hostage_entity" entities // "hostage_entity" entities
#define OFFSET_HOSTAGEFOLLOW 51 + EXTRAOFFSET // +21, long=51, int=107! (must use the long* offset becuase pointers on amd64 are stored the size of longs, 8 bytes, instead of the usual int 4 bytes.) #define OFFSET_HOSTAGEFOLLOW 51 + EXTRAOFFSET // +21, long=51, int=107! (must use the long* offset because pointers on amd64 are stored the size of longs, 8 bytes, instead of the usual int 4 bytes.)
#define OFFSET_HOSTAGEID 516 + EXTRAOFFSET // +29 #define OFFSET_HOSTAGEID 516 + EXTRAOFFSET // +29
#endif #endif
@ -190,6 +194,9 @@
#define SCOREATTRIB_BOMB 2 // t only #define SCOREATTRIB_BOMB 2 // t only
#define SCOREATTRIB_VIP 4 // ct only #define SCOREATTRIB_VIP 4 // ct only
#define AMD64_STATIONARY_NO 2
#define AMD64_STATIONARY_YES 3
enum CS_Internal_Models { enum CS_Internal_Models {
CS_DONTCHANGE = 0, CS_DONTCHANGE = 0,
CS_CT_URBAN = 1, CS_CT_URBAN = 1,