I don't know how did you plan to detect a team change by setting someone's team. I guess you meant cs_get_user_team.
Here's a solution using Okapi. Tested and works on Windows.
PHP Code:
#include <amxmodx>
#include <okapi>
#define PLUGIN "Detect Team Change"
#define VERSION "1.0"
#define AUTHOR "KliPPy"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
new methodAddress;
if(is_linux_server())
{
static const symbol[] = "_Z21HandleMenu_ChooseTeamP11CBasePlayeri";
methodAddress = okapi_mod_get_symbol_ptr(symbol);
}
else
{
static const signature[] = {0x83,0xEC,0xDEF,0x8B,0x0D,0xDEF,0xDEF,0xDEF,0xDEF,0x53,0x55,0x56,0x8B,0x74};
methodAddress = okapi_mod_find_sig(signature, sizeof(signature));
}
if(methodAddress == 0)
{
set_fail_state("Couldn't find HandleMenu_ChooseTeam.");
return;
}
new okapi_func:func_HandleMenu_ChooseTeam = okapi_build_function(methodAddress, arg_int, arg_cbase, arg_int);
okapi_add_hook(func_HandleMenu_ChooseTeam, "Hook_HandleMenu_ChooseTeam", true);
}
public Hook_HandleMenu_ChooseTeam(player, newTeam)
{
// This function may get called even if the team change wasn't successful. The function returns TRUE if the change was successful.
if(okapi_get_orig_return())
server_print("Team changed! Player: %d New Team: %d", player, newTeam);
}