View Single Post
Author Message
jugule
AlliedModders Donor
Join Date: Apr 2020
Old 05-22-2020 , 23:53   event crash problem
Reply With Quote #1

Hi, I also have a problem that I can't deal with.
If the function is as follows:
PHP Code:
public Action Event_RoundEnd(Event eventchar[] namebool dontBroadcast
{
for(
int x 1<= MaxClientsx++)
        {
            if(
IsValidClient(x))
            {
                
RemoveAllWeapons(x); // removing all players weapons
             
}   
            
        }

and if I remove this function from 'RoundEnd', the server crashes when the player_spawn function is called.

playerspawn:
PHP Code:

public Action Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)  
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
int weapon

    if (!
client)
    {
        return;
    }
    
    if(
IsClientInGame(client)) 
    {
        
RemoveAllWeapons(client);
        if(
GetClientTeam(client) == 2)
        {
            
            
            
weapon GivePlayerItem(client"weapon_knife"); 
            
EquipPlayerWeapon(clientweapon);
    
        }
        else if(
GetClientTeam(client) == 3)
        {
            
            
            
weapon GivePlayerItem(client"weapon_m9_bayonet"); 
            
EquipPlayerWeapon(clientweapon);
            
        }
    }

What would be the problem?
I specify that if no player has weapons at the end of the round in hand, the server does not fall. But if he has a knife, the server falls.

Last edited by jugule; 05-22-2020 at 23:55.
jugule is offline