Hey!
I have an plugin which gives healthshot to VIP players.
I have a problem with it, when the round ends, and the next round is starting, the healthshots is getting dropped into to floor, because the limit is 1 in the server.
I want to remove the non used healthshots at the end of the round. Here is the code:
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#pragma semicolon 1
#pragma newdecls required
public Plugin myinfo =
{
name = "MagyarHNS VIP Gránátok",
description = "Healthshot a VIP-eknek",
author = "Ervin",
version = "1.0.0",
url = "www.magyarhns.hu"
};
public void OnPluginStart()
{
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
}
public void Event_PlayerSpawn(Event hEvent, const char[] sEventName, bool bDontBroadcast)
{
int userid = hEvent.GetInt("userid");
if (IsClientInGame(GetClientOfUserId(userid)))
{
CreateTimer(0.3, Timer_Delay, userid, TIMER_FLAG_NO_MAPCHANGE);
}
}
public Action Timer_Delay(Handle hTimer, int userid)
{
int client = GetClientOfUserId(userid);
if(IsClientInGame(client) && CheckCommandAccess(client, "lofasz", ADMFLAG_CUSTOM6))
{
switch (GetClientTeam(client))
{
case 2:
{
GivePlayerItem(client, "weapon_healthshot");
}
case 3:
{
GivePlayerItem(client, "weapon_healthshot");
}
}
}
}