Hello. I've written a small plugin that should give grenades after PlayerSpawn and it does give, but it gives two of them, and I want it to spawn only one.
CVars are correct (ammo_grenade_limit_default and _flashbang set to 1) but it does spawn additional smoke and flashbang on the ground, under player's foot. I don't know why, that's why I need help
code:
PHP Code:
public Event_OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client > 0 && IsPlayerAlive(client))
{
if (IsPlayerGenericAdmin(client))
{
CreateTimer(1.0, GiveStuffToPlayer, client);
}
}
}
public Action GiveStuffToPlayer(Handle timer, any client)
{
GivePlayerItem(client, "weapon_smokegrenade");
GivePlayerItem(client, "weapon_flashbang");
SetEntProp(client, Prop_Send, "m_ArmorValue", 100);
SetEntProp(client, Prop_Send, "m_bHasHelmet", 1);
}
__________________