Decided to give it a try ,here's the code :
Code:
static const String:melee[][] = { "weapon_spade", "weapon_amerknife" };
.....
.....
HookEvent("player_hurt", player_hurt, EventHookMode_Pre);
.....
.....
.....
public player_hurt(Handle:event, const String:name[], bool:silent)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client > 0 && client <= MaxClients && IsClientInGame(client))
{
if (GetEventInt(event, "health") < 1)
{
switch (GetClientTeam(client))
{
case Team_Allies:
{
// Get the player's team and give proper weapon depends on team
GetEntPropEnt(Team_Allies-2, Prop_Send, "m_hOwnerEntity");
RemovePlayerItem(client, Team_Allies-2);
AcceptEntityInput(Team_Allies-2, "Kill");
}
case Team_Axis:
{
// Get the player's team and give proper weapon depends on team
GetEntPropEnt(Team_Axis-2, Prop_Send, "m_hOwnerEntity");
RemovePlayerItem(client, Team_Axis-2);
AcceptEntityInput(Team_Axis-2, "Kill");
}
}
}
}
}
so everything seems OK , the weapon disappears . But why then after you respawn(start new round) it disappears at all and all weapons. Tell me where I could make a mistake ?