Code:
//import miscellaneous natives including register_logevent()
#include <amxmodx>
//import Counter-Strike related natives
#include <cstrike>
//called when the plugin starts
public plugin_init()
{
//used to identify the plugin
register_plugin("PLUGIN", "VERSION", "AUTHOR");
//registers a function to be called at the end of a round
register_logevent("roundEnd", 2, "1=Round_End");
}
public roundEnd()
{
//stores the maximum number of players the server can accomodate
new maxPlayers = get_maxplayers();
//loops over each player slot
for(new i = 1; i <= maxPlayers; i++)
{
//if a player isn't connected in this slot, skip the remaining
//code inside the loop but continue iteration
if(!is_user_connected(i))
{
continue;
}
//determines which team the player in this slot belongs to
switch(cs_get_user_team(i))
{
//if the player in this slot is a T, switch them to CT
case CS_TEAM_T: cs_set_user_team(i, CS_TEAM_CT);
//if the player in this slot is a CT, switch them to T
case CS_TEAM_CT: cs_set_user_team(i, CS_TEAM_T);
}
}
}
The
Function Reference will come in handy in future.