if(newkeys & KEY_FIRE || newkeys & KEY_AIM) { if(RespondedToFire[playerid] == 1 && IsAtFire[playerid] == 1) { FireTimer[playerid] = SetTimerEx("PuttingOutFire",12000, true, "i",playerid); }
public PuttingOutFire(playerid) { DestroyObject(FireObject[playerid]); SendClientMessage(playerid,COLOR_LIGHTRED, "You have Extingushed the Fire."); DisablePlayerCheckpoint(playerid); RespondedToFire[playerid] = 0; SetTimer("RandFireTimer",200000,true); }
FireTimer[playerid] = SetTimerEx("PuttingOutFire",12000, true, "i",playerid);
set the "true" to "false" true - repeat the timer false - dont repeat the timer |
Kill FireTimer[playerid] timer once the player has Extingushed the Fire?
|
DestroyObject(FireObject)
DestroyObject(FireObject[playerid])
i Think you didnt understand my code when i wrote it to you. You have to kill FireTimer[playerid] when PuttingOutFire is called only once. set True to False as @Morpheus1992. True part is for repeat.
There were Two Timers. RandFireTimer and FireTimer[playerid]. the RandFireTimer is for creating Fire's at people's houses. and the other one is for Fire Fighter player who is extinguishing the fire. i told you in my post, set both to false to prevent unwanted lag and all in your server. You Put RandFireTimer to false and start it again when the previous fire is Extinguished. http://forum.sa-mp.com/showpost.php?...00&postcount=8 Read my post again. Also, we are not killing the FireTimer[playerid] anywhere because it was set to False on repeat according to my code. if you changed it to True, either set it to False or add KillTimer(FireTimer[playerid]) in public callback PuttingOutFire. EDIT: WHy are you taking FireObject as a Player ID based Object? Fire Object is only 1 for each players. so Use Код:
DestroyObject(FireObject) Код:
DestroyObject(FireObject[playerid]) |
public RandFireTimer(playerid)
{
new a = random(56),string[128];
FireObject = CreateObject(18691, HouseInfo[a][hEntrancex],HouseInfo[a][hEntrancey],HouseInfo[a][hEntrancez],0,0,0);
foreach(Player, i)
{
if(Isparamedic(i))
{
SendClientMessage(i, COLOR_LIGHTRED, "---Fire Dispatch ---");
format(string, sizeof(string), "Fire Was Seen at %s`s House.",HouseInfo[a][hOwner]);
SendClientMessage(i,COLOR_LIGHTRED, string);
SendClientMessage(i,COLOR_LIGHTRED, "Please Fire Fighters Respond to the call.");
SetPlayerCheckpoint(i, HouseInfo[a][hEntrancex],HouseInfo[a][hEntrancey],HouseInfo[a][hEntrancez],5);
CP[i] = 1; RespondedToFire[i] = 1;
}
}
return 1;
}
public PuttingOutFire(playerid)
{
if(RespondedToFire[playerid] == 1)
{
new a = random(56);
DestroyObject(FireObject[playerid]);
if(IsPlayerInRangeOfPoint(playerid, 4,HouseInfo[a][hEntrancex],HouseInfo[a][hEntrancey],HouseInfo[a][hEntrancez])) return SendClientMessage(playerid,COLOR_LIGHTRED, "You have Extingushed the Fire.");
DisablePlayerCheckpoint(playerid);
RespondedToFire[playerid] = 0;
SetTimer("RandFireTimer",200000,false);
}
return 1;
}
forward RandFireTimer(playerid);
forward RandFireTimer();
if(IsPlayerInRangeOfPoint(playerid, 4,HouseInfo[a][hEntrancex],HouseInfo[a][hEntrancey],HouseInfo[a][hEntrancez])) return SendClientMessage(playerid,COLOR_LIGHTRED, "You have Extingushed the Fire.");
SetTimer("RandFireTimer",200000,false);
if(RespondedToFire[playerid] == 1 && IsAtFire[playerid] == 1) { FireTimer[playerid] = SetTimerEx("PuttingOutFire",20000, true, "i",playerid); return 1; }