Tell me, what is wrong in this code, after the upgrade the server crash when trying to purchase:
Code:
public Action:CS_OnBuyCommand(client, const String:weapon[])
{
if(StrEqual(weapon, "vesthelm"))
return Plugin_Handled;
if(IsValidPlayer(client))
FakeClientCommand(client, "buy vest");
return Plugin_Continue;
}
stock bool:IsValidPlayer(client, bool:alive = false)
{
if(client>0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
{
if(alive && !IsPlayerAlive(client))
return false;
return true;
}
return false;
}
And with it all ok:
Code:
public Action:CS_OnBuyCommand(client, const String:weapon[])
{
if(StrEqual(weapon, "vesthelm"))
{
if(IsValidPlayer(client))
FakeClientCommand(client, "buy vest");
return Plugin_Handled;
}
return Plugin_Continue;
}