Nothing should have been wrong with my post back then, it just didn't give tasers on spawn.
PHP Code:
#include <sourcemod>
#include <sdktools>
#pragma newdecls required
public void OnPluginStart()
{
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}
public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid"));
if (client && GetClientTeam(client) > 1)
{
GivePlayerItem(client, "weapon_taser");
}
}
public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
int attacker = GetClientOfUserId(event.GetInt("attacker"));
if(attacker && IsPlayerAlive(attacker))
{
char weapon[64];
GetEventString(event, "weapon", weapon, sizeof(weapon));
if(StrEqual(weapon, "taser", false))
{
CreateTimer(1.0, Timer_GiveZeus, GetClientSerial(attacker));
}
}
}
public Action Timer_GiveZeus(Handle timer, any serial)
{
int client = GetClientFromSerial(serial);
if(client && IsPlayerAlive(client))
{
int equipped = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
GivePlayerItem(client, "weapon_taser");
EquipPlayerWeapon(client, equipped);
}
}