View Single Post
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 12-15-2018 , 03:44   Re: [CS GO] client for start_round event
Reply With Quote #5

Quote:
Originally Posted by Indarello View Post
Code:
public Action Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
    CreateTimer(3.0, UpdateDelay);
	
    return Plugin_Continue;
}

/*********************************
 *  Public Timers
 *********************************/
public Action UpdateDelay(Handle timer, any serial)
{
    for(int i = 1; i <= MaxClients; i++)
    {
		if(IsValidClient(client))
		{
			
		}
    }
}
this is true??

PHP Code:
int g_iTimer[MAXPLAYERS+1];

/*********************************
 *  Event_RoundStart
 *********************************/
public Action Event_RoundStart(Event event, const char[] namebool dontBroadcast)
{
    
CreateTimer(3.0UpdateDelay);
    return 
Plugin_Continue;
}

/*********************************
 *  Public UpdateDelay Timer
 *********************************/
public Action UpdateDelay(Handle timer)
{
    for(
int i 1<= MaxClientsi++)
    {
        if(
IsValidClient(i))
        {
            
CreateTimer(1.0CheckEveryClientGetClientSerial(i));
        }
        return 
Plugin_Stop;
    }
}

/*********************************
 *  Public CheckEveryClient Timer
 *********************************/
public Action CheckEveryClient(Handle timerany serial)
{
    
int client GetClientFromSerial(serial);
    
    if(!
IsValidClient(client))
    {
        return 
Plugin_Stop;
    }

    if(
g_iTimer >= 30)
    {
        
//code is here, for every client on round start after 30s
        
g_iTimer[client] = 0;
        return 
Plugin_Stop;
    }
    else
    {
        
g_iTimer[client]++;
        return 
Plugin_Continue;
    }
}

/*********************************
 *  IsValidClient
 *********************************/
stock bool IsValidClient(int client)
{
    if(
client <= 0)
        return 
false;
    if(
client MaxClients)
        return 
false;
    if(!
IsClientInGame(client))
        return 
false;
    if(!
IsClientSourceTV(client))
        return 
false;
    if(
IsFakeClient(client))
        return 
false;
    return 
true;


Last edited by Dr.Mohammad; 12-15-2018 at 03:46.
Dr.Mohammad is offline