Quote:
Originally Posted by Napoleon_be
Untested. Was already working on a swap system while i didn't realise u have a command for that, that's why there's code between comment lines.
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx> #include <cstrike> #include <colorchat>
#define PLUGIN "MixSwap" #define VERSION "1.0" #define AUTHOR "NapoleoN#"
new szTextMsg new iTerWin; new iCtWin;
//new CsTeams:iOldTeam; //new CsTeams:iNewTeam;
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("say /status", "ShowScore"); szTextMsg = get_user_msgid("TextMsg"); register_message(szTextMsg, "msgTextMsg"); }
public msgTextMsg() { static szMsg[22]; get_msg_arg_string(2, szMsg, charsmax(szMsg)); if(equal(szMsg, "#Terrorists_Win")) { iTerWin++; if(iTerWin == 9) { server_cmd("amx_swap"); iTerWin = iCtWin; //CheckTeams(); } else if(iTerWin == 15) { server_cmd("amx_warm"); } } else if(equal(szMsg, "#CTs_Win")) { iCtWin++; if(iCtWin == 9) { server_cmd("amx_swap"); iCtWin = iTerWin; //CheckTeams(); } else if(iCtWin == 15) { server_cmd("amx_warm"); } } return PLUGIN_CONTINUE; }
public ShowScore(id) { ColorChat(id, GREEN, "[CT WINS]: %i | [TER WINS]: %i", iCtWin, iTerWin); }
/*CheckTeams() { new iPlayers[32], iNum; get_players(iPlayers, iNum); for(new i; i < iNum; i++) { iOldTeam = cs_get_user_team(iPlayers[i]); if(iOldTeam == CS_TEAM_T) { iNewTeam = CS_TEAM_CT; } else if(iOldTeam == CS_TEAM_CT) { iNewTeam = CS_TEAM_T; } cs_set_user_team(iPlayers[i], iNewTeam); } }*
|
Your CheckTeams() function can be just that, without using any global variables.
PHP Code:
CheckTeams()
{
new iPlayers[32], iNum, id
get_players(iPlayers, iNum)
for(new i; i < iNum;i++)
{
id = iPlayers[i]
if(1 <= get_user_team(id) <= 2)
{
cs_set_user_team(id, (get_user_team(id) == 1) ? CS_TEAM_CT : CS_TEAM_T)
}
}
}
__________________