Code:
public void OnPluginStart()
{
HookEvent("round_end", RoundEnd, EventHookMode_Pre);
}
public Action:RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
for( new client=1; client<=MaxClients; client++)
{
new i = 3;
{
new ent;
while((ent = GetPlayerWeaponSlot(client, i)) != -1)
{
RemovePlayerItem(client, ent);
AcceptEntityInput(ent, "Kill");
}
}
}
}
I copied this, but I modified it a little but, though I kept while cycle as it is, here is the code I am using right now (tried to do something with medishot, it worked, but suddenly stopped working for some reason).
Code:
public OnPluginStart(){
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast){
int client = GetClientOfUserId(event.GetInt("userid"));
if (client)
{
if (CheckCommandAccess(client, "", ADMFLAG_RESERVATION, true))
{
RemoveClientGrenades(client);
}
}
}
void RemoveClientGrenades(int client)
{
int ent = -1;
int enthealth = -1;
while ((ent = GetPlayerWeaponSlot(client, CS_SLOT_GRENADE)) != -1)
{
RemovePlayerItem(client, ent);
RemoveEntity(ent);
}
while ((enthealth = GetPlayerWeaponSlot(client, 57)) != -1)
{
RemovePlayerItem(client, enthealth);
RemoveEntity(enthealth);
}
}