View Single Post
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 04-06-2019 , 11:58   Re: Check if player has grenade/equip on spawn
Reply With Quote #9

PHP Code:

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
    if (
client)
    {
        if (
CheckCommandAccess(client""ADMFLAG_RESERVATIONtrue))
        {
            
RemoveClientGrenades(client);
        }
    }
}

void RemoveClientGrenades(int client)
{
    
int ent = -1;
    
    while ((
ent GetPlayerWeaponSlot(clientCS_SLOT_GRENADE)) != -1)
    {
        
RemovePlayerItem(clientent);
        
RemoveEntity(ent);
    }

Use the new syntax.
round_end it's a general thing, it's not like player_death, player_spawn, player_hurt etc, so it doesn't have "userid" param.
__________________

Last edited by Ilusion9; 04-06-2019 at 12:00.
Ilusion9 is offline