View Single Post
eyal282
Veteran Member
Join Date: Aug 2011
Old 10-02-2018 , 10:14   Re: CREATE TIMER for plugin
Reply With Quote #2

Code:
#include <sourcemod> 
#include <cstrike> 
#include <sdktools> 

public void OnPluginStart()
{
    HookEvent("round_end", round_end);
}

public Action round_end(Handle event, const char[] name, bool dontbroadcast)
{
    ServerCommand("mp_autoteambalance 0");

    CreateTimer(2.0, goct);
    for (new i = 1; i <= MaxClients; i++) 
    {
        ChangeClientTeam(i, CS_TEAM_T);
    }
} 

public Action goct(Handle timer, ctone)
{
for(new i=1;i <= MaxClients;i++)
{
if(!isClientInGame(i))
continue;

else if(GetClientTeam(i) != CS_TEAM_T)
continue;

ChangeClientTeam(i, CS_TEAM_CT);
}
}
}
On a different scenario:

GetClientTeam(CS_TEAM_T)

This is a mistake, meaning that no what what, this will ALWAYS return either true or false ( IDK which ).

This means that either no player will be taken as a random player or that all players will, depending on whether or not the client that has the index same as CS_TEAM_T has is any team apart from unassigned. Fix it.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 10-02-2018 at 10:14.
eyal282 is offline