Hello,
I'm trying to develop a plugin to auto kill spitter after spit_burst event to avoid players hold spitter for long time in game.
Tried the below code but didn't work and i don't know why:
PHP Code:
#include <sourcemod>
#include <sdktools>
#define PLUGIN_VERSION "1.0"
public Plugin:myinfo =
{
name = "Spitter Auto Kill",
author = "diorfo",
description = "Spitter Auto Kill after Spit",
version = PLUGIN_VERSION,
url = ""
}
public OnPluginStart()
{
CreateConVar("sm_l4d2_spitter_auto_kill", PLUGIN_VERSION, "Spitter Auto Kill", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
HookEvent("spit_burst", Event_SpitBurst);
}
public Event_SpitBurst (Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid"));
new Handle:idfix = CreateDataPack();
WritePackCell(idfix, GetClientUserId(client));
PrintToChat(client, "\x04[SM] \x05Voce spitou e morrera em 10s");
CreateTimer(10.0, kill_spitter);
}
public Action:kill_spitter(Handle:timer, any:idfix)
{
GetClientOfUserId(ReadPackCell(idfix));
ForcePlayerSuicide(idfix);
}
looks like the id of spitter is losing in
public Action:kill_spitter because if i change the
CreateTimer(10.0, kill_spitter) for
ForcePlayerSuicide(client) the spitter is killed instantly after spit and i'd like to set a time before she get auto killed.
Any ideas what is it wrong in code?