So you PMed me your code. ill display the main code here.
PHP код:
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;
}
There are a Few Mistakes in your above code and a few Declaration problems causing that.
Follow these steps:
1> Idk what is MAX_FIRES you defined at the top. if it was for Fire System, remove it, its of no use.
2> Again. RandFireTimer is not a Playerid based variable. so instead of.
Код:
forward RandFireTimer(playerid);
Use
Код:
forward RandFireTimer();
Also remove playerid from Public callback too.
3>FireObject is not a Playerid based Object. Use new FireObject instead of new FireObject[playerid].
remove [playerid] along with FireObject Where ever you used it.
4>Remove
Код:
if(IsPlayerInRangeOfPoint(playerid, 4,HouseInfo[a][hEntrancex],HouseInfo[a][hEntrancey],HouseInfo[a][hEntrancez])) return SendClientMessage(playerid,COLOR_LIGHTRED, "You have Extingushed the Fire.");
from PuttingOutFire Public. its of no use. Because a's value will not be same as in RandFireTimer.
5>Set Timer RandFireTimer repeat to false instead of True in PuttingOutFire Public and OnGameModeInit.
Код:
SetTimer("RandFireTimer",200000,false);
6> You have to return 1 after your body ends in OnPlayerStateChange.
Код:
if(RespondedToFire[playerid] == 1 && IsAtFire[playerid] == 1)
{
FireTimer[playerid] = SetTimerEx("PuttingOutFire",20000, true, "i",playerid);
return 1;
}
I Hope your Problems will be fixed now.