From d5c75fd6a56c4977527b43c14f40c2b4896173ec Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 30 Oct 2005 14:17:32 +0000 Subject: [PATCH] What... --- amxmodx/modules.cpp | 18 ++++++++++++++++++ amxmodx/sdk/amxxmodule.cpp | 3 +++ amxmodx/sdk/amxxmodule.h | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index 8877b523..882f4824 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -1577,6 +1577,23 @@ void Module_UncacheFunctions() g_functions.clear(); } +int MNF_SetPlayerTeamInfo(int player, int teamid, const char *teamname) +{ + if (player < 1 || player > gpGlobals->maxClients) + return 0; + + CPlayer *pPlayer = GET_PLAYER_POINTER_I(player); + + if (!pPlayer->ingame) + return 0; + + pPlayer->teamId = teamid; + if (teamname != NULL) + pPlayer->team.assign(teamname); + + return 1; +} + int amx_Execv() { return AMX_ERR_NOTFOUND; @@ -1658,6 +1675,7 @@ void Module_CacheFunctions() REGISTER_FUNC("GetPlayerEdict", MNF_GetPlayerEdict) REGISTER_FUNC("CellToReal", MNF_CellToReal) REGISTER_FUNC("RealToCell", MNF_RealToCell) + REGISTER_FUNC("SetPlayerTeamInfo", MNF_SetPlayerTeamInfo) #ifdef MEMORY_TEST REGISTER_FUNC("Allocator", m_allocator) diff --git a/amxmodx/sdk/amxxmodule.cpp b/amxmodx/sdk/amxxmodule.cpp index e374e441..d0a5fb0d 100755 --- a/amxmodx/sdk/amxxmodule.cpp +++ b/amxmodx/sdk/amxxmodule.cpp @@ -2502,6 +2502,7 @@ PFN_FORMAT g_fn_Format; PFN_REGISTERFUNCTION g_fn_RegisterFunction; PFN_REQ_FNPTR g_fn_RequestFunction; PFN_AMX_PUSH g_fn_AmxPush; +PFN_SET_TEAM_INFO g_fn_SetTeamInfo; // *** Exports *** C_DLLEXPORT int AMXX_Query(int *interfaceVersion, amxx_module_info_s *moduleInfo) @@ -2611,6 +2612,7 @@ C_DLLEXPORT int AMXX_Attach(PFN_REQ_FNPTR reqFnptrFunc) REQFUNC("GetPlayerFlags", g_fn_GetPlayerFlags, PFN_GETPLAYERFLAGS); REQFUNC("GetPlayerEdict", g_fn_GetPlayerEdict, PFN_GET_PLAYER_EDICT); REQFUNC("amx_Push", g_fn_AmxPush, PFN_AMX_PUSH); + REQFUNC("SetPlayerTeamInfo", g_fn_SetTeamInfo, PFN_SET_TEAM_INFO); #ifdef MEMORY_TEST // Memory @@ -2733,6 +2735,7 @@ void ValidateMacros_DontCallThis_Smiley() MF_GetPlayerEdict(0); MF_Format("", 4, "str"); MF_RegisterFunction(NULL, ""); + MF_SetPlayerTeamInfo(0, 0, ""); } #endif diff --git a/amxmodx/sdk/amxxmodule.h b/amxmodx/sdk/amxxmodule.h index 0a000d20..65622fd5 100755 --- a/amxmodx/sdk/amxxmodule.h +++ b/amxmodx/sdk/amxxmodule.h @@ -2003,6 +2003,7 @@ typedef void (*PFN_MERGEDEFINITION_FILE) (const char * /*filename*/); typedef const char * (*PFN_FORMAT) (const char * /*fmt*/, ... /*params*/); typedef void (*PFN_REGISTERFUNCTION) (void * /*pfn*/, const char * /*desc*/); typedef int (*PFN_AMX_PUSH) (AMX * /*amx*/, cell /*value*/); +typedef int (*PFN_SET_TEAM_INFO) (int /*player */, int /*teamid */, const char */*name */); extern PFN_ADD_NATIVES g_fn_AddNatives; extern PFN_BUILD_PATHNAME g_fn_BuildPathname; @@ -2066,6 +2067,7 @@ extern PFN_GET_PLAYER_TEAM g_fn_GetPlayerTeam; extern PFN_REGISTERFUNCTION g_fn_RegisterFunction; extern PFN_REQ_FNPTR g_fn_RequestFunction; extern PFN_AMX_PUSH g_fn_AmxPush; +extern PFN_SET_TEAM_INFO g_fn_SetTeamInfo; #ifdef MAY_NEVER_BE_DEFINED // Function prototypes for intellisense and similar systems @@ -2126,6 +2128,7 @@ void MF_RegisterFunction (void *pfn, const char *description) { } void * MF_RequestFunction (const char *description) { } int MF_AmxPush (AMX *amx, cell *params) { } int MF_AmxExec (AMX *amx, cell *retval, int idx) { } +int MF_SetPlayerTeamInfo (int id, int teamid, const char *teamname) { } #endif // MAY_NEVER_BE_DEFINED #define MF_AddNatives g_fn_AddNatives @@ -2191,6 +2194,7 @@ void MF_LogError(AMX *amx, int err, const char *fmt, ...); #define MF_RegisterFunction g_fn_RegisterFunction #define MF_RequestFunction g_fn_RequestFunction; #define MF_AmxPush g_fn_AmxPush +#define MF_SetPlayerTeamInfo g_fn_SetTeamInfo #ifdef MEMORY_TEST /*** Memory ***/