mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 14:55:36 +03:00
Committed new SDK function for player property mappings
This commit is contained in:
parent
23fb93a3cc
commit
a8bb28caa4
@ -1594,6 +1594,60 @@ int MNF_SetPlayerTeamInfo(int player, int teamid, const char *teamname)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *MFN_PlayerPropAddr(int id, int prop)
|
||||||
|
{
|
||||||
|
if (id < 1 || id > gpGlobals->maxClients)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CPlayer *pPlayer = GET_PLAYER_POINTER_I(id);
|
||||||
|
|
||||||
|
switch (prop)
|
||||||
|
{
|
||||||
|
case Player_Name:
|
||||||
|
return &pPlayer->name;
|
||||||
|
case Player_Ip:
|
||||||
|
return &pPlayer->ip;
|
||||||
|
case Player_Team:
|
||||||
|
return &pPlayer->team;
|
||||||
|
case Player_Ingame:
|
||||||
|
return &pPlayer->ingame;
|
||||||
|
case Player_Authorized:
|
||||||
|
return &pPlayer->authorized;
|
||||||
|
case Player_Vgui:
|
||||||
|
return &pPlayer->vgui;
|
||||||
|
case Player_Time:
|
||||||
|
return &pPlayer->time;
|
||||||
|
case Player_Playtime:
|
||||||
|
return &pPlayer->playtime;
|
||||||
|
case Player_MenuExpire:
|
||||||
|
return &pPlayer->menuexpire;
|
||||||
|
case Player_Weapons:
|
||||||
|
return &pPlayer->weapons[0];
|
||||||
|
case Player_CurrentWeapon:
|
||||||
|
return &pPlayer->current;
|
||||||
|
case Player_TeamID:
|
||||||
|
return &pPlayer->teamId;
|
||||||
|
case Player_Deaths:
|
||||||
|
return &pPlayer->deaths;
|
||||||
|
case Player_Aiming:
|
||||||
|
return &pPlayer->aiming;
|
||||||
|
case Player_Menu:
|
||||||
|
return &pPlayer->menu;
|
||||||
|
case Player_Keys:
|
||||||
|
return &pPlayer->keys;
|
||||||
|
case Player_Flags:
|
||||||
|
return &pPlayer->flags[0];
|
||||||
|
case Player_Newmenu:
|
||||||
|
return &pPlayer->newmenu;
|
||||||
|
case Player_NewmenuPage:
|
||||||
|
return &pPlayer->page;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int amx_Execv()
|
int amx_Execv()
|
||||||
{
|
{
|
||||||
return AMX_ERR_NOTFOUND;
|
return AMX_ERR_NOTFOUND;
|
||||||
@ -1676,6 +1730,7 @@ void Module_CacheFunctions()
|
|||||||
REGISTER_FUNC("CellToReal", MNF_CellToReal)
|
REGISTER_FUNC("CellToReal", MNF_CellToReal)
|
||||||
REGISTER_FUNC("RealToCell", MNF_RealToCell)
|
REGISTER_FUNC("RealToCell", MNF_RealToCell)
|
||||||
REGISTER_FUNC("SetPlayerTeamInfo", MNF_SetPlayerTeamInfo)
|
REGISTER_FUNC("SetPlayerTeamInfo", MNF_SetPlayerTeamInfo)
|
||||||
|
REGISTER_FUNC("PlayerPropAddr", MFN_PlayerPropAddr)
|
||||||
|
|
||||||
#ifdef MEMORY_TEST
|
#ifdef MEMORY_TEST
|
||||||
REGISTER_FUNC("Allocator", m_allocator)
|
REGISTER_FUNC("Allocator", m_allocator)
|
||||||
|
@ -48,6 +48,29 @@
|
|||||||
#define RELOAD_MODULE 0
|
#define RELOAD_MODULE 0
|
||||||
#define STATIC_MODULE 1
|
#define STATIC_MODULE 1
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
Player_Name, //String
|
||||||
|
Player_Ip, //String
|
||||||
|
Player_Team, //String
|
||||||
|
Player_Ingame, //bool
|
||||||
|
Player_Authorized, //bool
|
||||||
|
Player_Vgui, //bool
|
||||||
|
Player_Time, //float
|
||||||
|
Player_Playtime, //float
|
||||||
|
Player_MenuExpire, //float
|
||||||
|
Player_Weapons, //struct{int,int}[32]
|
||||||
|
Player_CurrentWeapon, //int
|
||||||
|
Player_TeamID, //int
|
||||||
|
Player_Deaths, //int
|
||||||
|
Player_Aiming, //int
|
||||||
|
Player_Menu, //int
|
||||||
|
Player_Keys, //int
|
||||||
|
Player_Flags, //int[32]
|
||||||
|
Player_Newmenu, //int
|
||||||
|
Player_NewmenuPage, //int
|
||||||
|
} PlayerProp;
|
||||||
|
|
||||||
int CheckModules(AMX *amx, char error[128]);
|
int CheckModules(AMX *amx, char error[128]);
|
||||||
const char *StrCaseStr(const char *as, const char *bs);
|
const char *StrCaseStr(const char *as, const char *bs);
|
||||||
void DisableDebugHandler(AMX *amx);
|
void DisableDebugHandler(AMX *amx);
|
||||||
|
@ -2503,6 +2503,7 @@ PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
|||||||
PFN_REQ_FNPTR g_fn_RequestFunction;
|
PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||||
PFN_AMX_PUSH g_fn_AmxPush;
|
PFN_AMX_PUSH g_fn_AmxPush;
|
||||||
PFN_SET_TEAM_INFO g_fn_SetTeamInfo;
|
PFN_SET_TEAM_INFO g_fn_SetTeamInfo;
|
||||||
|
PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr;
|
||||||
|
|
||||||
// *** Exports ***
|
// *** Exports ***
|
||||||
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo)
|
||||||
@ -2613,6 +2614,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc)
|
|||||||
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT);
|
||||||
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH);
|
||||||
REQFUNC("SetPlayerTeamInfo", g_fn_SetTeamInfo, PFN_SET_TEAM_INFO);
|
REQFUNC("SetPlayerTeamInfo", g_fn_SetTeamInfo, PFN_SET_TEAM_INFO);
|
||||||
|
REQFUNC("PlayerPropAddr", g_fn_PlayerPropAddr, PFN_PLAYER_PROP_ADDR);
|
||||||
|
|
||||||
#ifdef MEMORY_TEST
|
#ifdef MEMORY_TEST
|
||||||
// Memory
|
// Memory
|
||||||
@ -2736,6 +2738,7 @@ void ValidateMacros_DontCallThis_Smiley()
|
|||||||
MF_Format("", 4, "str");
|
MF_Format("", 4, "str");
|
||||||
MF_RegisterFunction(NULL, "");
|
MF_RegisterFunction(NULL, "");
|
||||||
MF_SetPlayerTeamInfo(0, 0, "");
|
MF_SetPlayerTeamInfo(0, 0, "");
|
||||||
|
MF_PlayerPropAddr(0, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1927,6 +1927,28 @@ enum ForwardParam
|
|||||||
FP_ARRAY, // array; use the return value of prepareArray.
|
FP_ARRAY, // array; use the return value of prepareArray.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum PlayerProp
|
||||||
|
{
|
||||||
|
Player_Name, //String
|
||||||
|
Player_Ip, //String
|
||||||
|
Player_Team, //String
|
||||||
|
Player_Ingame, //bool
|
||||||
|
Player_Authorized, //bool
|
||||||
|
Player_Vgui, //bool
|
||||||
|
Player_Time, //float
|
||||||
|
Player_Playtime, //float
|
||||||
|
Player_MenuExpire, //float
|
||||||
|
Player_Weapons, //struct{int,int}[32]
|
||||||
|
Player_CurrentWeapon, //int
|
||||||
|
Player_TeamID, //int
|
||||||
|
Player_Deaths, //int
|
||||||
|
Player_Aiming, //int
|
||||||
|
Player_Menu, //int
|
||||||
|
Player_Keys, //int
|
||||||
|
Player_Flags, //int[32]
|
||||||
|
Player_Newmenu, //int
|
||||||
|
Player_NewmenuPage, //int
|
||||||
|
};
|
||||||
|
|
||||||
typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
typedef int (*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO * /*list*/);
|
||||||
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
typedef char * (*PFN_BUILD_PATHNAME) (const char * /*format*/, ...);
|
||||||
@ -1978,6 +2000,7 @@ typedef edict_t * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
|||||||
#else
|
#else
|
||||||
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
typedef void * (*PFN_GET_PLAYER_EDICT) (int /*id*/);
|
||||||
#endif
|
#endif
|
||||||
|
typedef void * (*PFN_PLAYER_PROP_ADDR) (int /*id*/, int /*prop*/);
|
||||||
|
|
||||||
#ifdef MEMORY_TEST
|
#ifdef MEMORY_TEST
|
||||||
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
typedef void * (*PFN_ALLOCATOR) (const char* /*filename*/, const unsigned int /*line*/, const char* /*func*/,
|
||||||
@ -2068,6 +2091,7 @@ extern PFN_REGISTERFUNCTION g_fn_RegisterFunction;
|
|||||||
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
extern PFN_REQ_FNPTR g_fn_RequestFunction;
|
||||||
extern PFN_AMX_PUSH g_fn_AmxPush;
|
extern PFN_AMX_PUSH g_fn_AmxPush;
|
||||||
extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo;
|
extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo;
|
||||||
|
extern PFN_PLAYER_PROP_ADDR g_fn_PlayerPropAddr;
|
||||||
|
|
||||||
#ifdef MAY_NEVER_BE_DEFINED
|
#ifdef MAY_NEVER_BE_DEFINED
|
||||||
// Function prototypes for intellisense and similar systems
|
// Function prototypes for intellisense and similar systems
|
||||||
@ -2129,6 +2153,7 @@ void * MF_RequestFunction (const char *description) { }
|
|||||||
int MF_AmxPush (AMX *amx, cell *params) { }
|
int MF_AmxPush (AMX *amx, cell *params) { }
|
||||||
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
int MF_AmxExec (AMX *amx, cell *retval, int idx) { }
|
||||||
int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { }
|
int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { }
|
||||||
|
void * MF_PlayerPropAddr (int id, int prop) { }
|
||||||
#endif // MAY_NEVER_BE_DEFINED
|
#endif // MAY_NEVER_BE_DEFINED
|
||||||
|
|
||||||
#define MF_AddNatives g_fn_AddNatives
|
#define MF_AddNatives g_fn_AddNatives
|
||||||
@ -2195,6 +2220,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...);
|
|||||||
#define MF_RequestFunction g_fn_RequestFunction;
|
#define MF_RequestFunction g_fn_RequestFunction;
|
||||||
#define MF_AmxPush g_fn_AmxPush
|
#define MF_AmxPush g_fn_AmxPush
|
||||||
#define MF_SetPlayerTeamInfo g_fn_SetTeamInfo
|
#define MF_SetPlayerTeamInfo g_fn_SetTeamInfo
|
||||||
|
#define MF_PlayerPropAddr g_fn_PlayerPropAddr
|
||||||
|
|
||||||
#ifdef MEMORY_TEST
|
#ifdef MEMORY_TEST
|
||||||
/*** Memory ***/
|
/*** Memory ***/
|
||||||
|
Loading…
Reference in New Issue
Block a user