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 event, char[] name, bool dontBroadcast)
{
for(int x = 1; x <= MaxClients; x++)
{
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[] name, bool 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(client, weapon);
}
else if(GetClientTeam(client) == 3)
{
weapon = GivePlayerItem(client, "weapon_m9_bayonet");
EquipPlayerWeapon(client, weapon);
}
}
}
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.