View Single Post
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 10-02-2018 , 12:16   Re: CREATE TIMER for plugin
Reply With Quote #3

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

public void OnPluginStart()
{
    
HookEvent("round_prestart"round_prestart);
}

public 
Action round_prestart(Handle event, const char[] namebool dontbroadcast)
{
    
ServerCommand("mp_autoteambalance 0");
    
int ctone GetRandomPlayer();
    
    if (
ctone)
    {
        
CS_SwitchTeam(ctoneCS_TEAM_CT);
    }

    for (
int i 1<= MaxClientsi++) 
    {
        if (
IsClientInGame(i) && != ctone)
        {
            
CS_SwitchTeam(iCS_TEAM_T);
        }
    }


GetRandomPlayer() 

    
int clients[MAXPLAYERS 1], clientCount;
    
    for (
int i 1<= MaxClientsi++) 
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == CS_TEAM_T)
        {
            
clients[clientCount++] = i;
        }
    }

    return 
clientCount clients[GetRandomInt(0clientCount 1)] : 0


Last edited by Ilusion9; 10-02-2018 at 12:16.
Ilusion9 is offline