Edit: Updated per Arkshine & Klippy's comments.
Signature created using cstrike module from 1.8.3 dev+4748
I only tested this on Windows.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <orpheu>
#include <orpheu_memory>
new const Version[] = "0.2";
const CellSizeBytes = ( cellbits / 8 );
#define GetParams(%1,%2) (%1 + (%2 * CellSizeBytes))
public plugin_init()
{
register_plugin( "cs_set_user_team hook" , Version , Version );
OrpheuRegisterHook( OrpheuGetFunction( "cs_set_user_team" ) , "Hook_cs_set_user_team" );
register_clcmd( "say test" , "test" );
}
public test( id )
{
cs_set_user_team( id , CS_TEAM_SPECTATOR , CS_DONTCHANGE );
}
public OrpheuHookReturn:Hook_cs_set_user_team( amx , params )
{
//From cstrike module: CstrikeNatives.cpp
// static cell AMX_NATIVE_CALL cs_set_user_team(AMX *amx, cell *params) // cs_set_user_team(index, team, model = 0); = 3 params
// {
// params[1] = user index
// params[2] = team
// params[3] = model = 0
new iPlayer = OrpheuMemoryGetAtAddress( GetParams( params , 1 ) , "int" );
new iTeam = OrpheuMemoryGetAtAddress( GetParams( params , 2 ) , "int" );
new iModel = OrpheuMemoryGetAtAddress( GetParams( params , 3 ) , "int" );
client_print( iPlayer , print_chat , "cs_set_user_team was called: id=%d Team=%d Model=%d" , iPlayer , iTeam , iModel );
}
Output:
Code:
cs_set_user_team : id=1 Team=3 Model=0
File: amxmodx\configs\orpheu\functions\cs_set_user_ team
Code:
{
"name" : "cs_set_user_team",
"library" : "cstrike",
"arguments" :
[
{
"type" : "int"
},
{
"type" : "int"
}
],
"identifiers":
[
{
"os" : "windows",
"mod" : "cstrike",
"value" : [0x55,0x8B,"*",0x83,"*","*",0xA1,0xB8,"*","*","*",0x33,0xC5,0x89,0x45,"*",0x56,0x8B,"*","*",0x8B,0x46,"*",0x57,0x8B,"*","*",0x83,0xF8]
},
{
"os" : "linux",
"mod" : "cstrike",
"value" : "cs_set_user_team"
}
]
}
File: amxmodx\configs\orpheu\memory\int
Code:
{
"name" : "int",
"type" : "int",
"memoryType" : "data",
"identifiers" :
[
{
"os" : "windows",
"value" : 0
},
{
"os" : "linux",
"value" : 0
}
]
}
__________________