In a very basic way you would do this, or you can save the amount of player team changes in a Trie that is cleared at every map change, good luck.
PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
new g_movelimit
new iTransferTimes[33]
public plugin_init()
{
register_plugin("Players transfer", "1.9.0.5271", "")
register_clcmd("say /spec","spec")
register_clcmd("say_team /spec","spec")
register_clcmd("say /ct","ct")
register_clcmd("say_team /ct","ct")
register_clcmd("say /t","t")
register_clcmd("say_team /t","t")
g_movelimit = register_cvar("move_limit", "3")
}
public client_connect(id)
{
iTransferTimes[id] = 0
}
public spec(id)
{
iTransferTimes[id] += 1
if(iTransferTimes[id] >= get_pcvar_num(g_movelimit))
{
color_chat(id, "^4%s^3 This command can be used only^4 3 times per map")
return PLUGIN_HANDLED
}
cs_set_user_team(id,CS_TEAM_SPECTATOR)
if(is_user_alive(id))
user_silentkill(id)
return PLUGIN_HANDLED
}
public ct(id)
{
cs_set_user_team(id,CS_TEAM_CT)
user_silentkill(id)
return PLUGIN_HANDLED
}
public t(id)
{
cs_set_user_team(id,CS_TEAM_T)
user_silentkill(id)
return PLUGIN_HANDLED
}
stock color_chat(const id, const input[], any:...)
{
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^4"); // Green Color
replace_all(msg, 190, "!y", "^1"); // Default Color
replace_all(msg, 190, "!team", "^3"); // Team Color
replace_all(msg, 190, "!team2", "^0"); // Team2 Color
if (id) players[0] = id; else get_players(players, count, "ch");
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
__________________