Quote:
Originally Posted by tobi187
Thats what i have and it doesnt work for me...
|
Yeah, problem is that game event is coming little early than you can change c4 defusing end time.
So you need delay it just little.
I shorted also player defusing bar
PHP Code:
#include <sdktools>
public OnPluginStart()
{
HookEventEx("bomb_begindefuse", begindefuse);
}
public begindefuse(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
CreateTimer(0.0, timer_delay, userid); // Need delay
}
public Action:timer_delay(Handle:timer, any:userid)
{
new client = GetClientOfUserId(userid);
if(client != 0)
{
if(IsPlayerAlive(client))
{
new Float:defuse_time;
if(GetEntProp(client, Prop_Send, "m_bHasDefuser"))
{
defuse_time = 3.0;
}
else
{
defuse_time = 5.0;
}
new c4 = FindEntityByClassname(MaxClients+1, "planted_c4");
if(c4 != -1)
{
SetEntPropFloat(c4, Prop_Send, "m_flDefuseCountDown", GetGameTime()+defuse_time);
SetEntProp(client, Prop_Send, "m_iProgressBarDuration", RoundFloat(defuse_time));
}
}
}
}