View Single Post
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 05-11-2019 , 22:21   Re: Execute Command Once every spawn
Reply With Quote #2

Quote:
Originally Posted by NickischLP View Post
Hello,

I am trying to execute a command on every respawn on time.
But the command is in a loop, I couldnt figure out how to stop it.
PHP Code:
public void OnPluginStart()
{
    
HookEvent("player_spawn"SpawnEventEventHookMode);
}

public 
Action:SpawnEvent(Handle event,char[] name,bool dontBroadcast)
{
    
int iClient_id GetEventInt(event"userid");
    
int iClient GetClientOfUserId(iClient_id);
    if(
IsClientInGame(iClient) && IsPlayerAlive(iClient) && TFTeam_Red)
    {
        
ServerCommand("sm_titan \"%N\" "iClient);
    }
    else
    {
        
PrintToServer("NOT WORKING");
    }

what do u mean by the command is in loop?
__________________
8guawong is offline