DestroyFire Object Problem
#1

Hello. I hava a fire system , but when i kill a fire , i got the message instantly!
http://imgur.com/a/A6q94
i got this message every 3 seconds...
http://imgur.com/a/FT8IK
Код:
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);
}
Reply
#2

FireTimer[playerid] = SetTimerEx("PuttingOutFire",12000, true, "i",playerid);

set the "true" to "false"

true - repeat the timer
false - dont repeat the timer
Reply
#3

Quote:
Originally Posted by Morpheus1992
Посмотреть сообщение
FireTimer[playerid] = SetTimerEx("PuttingOutFire",12000, true, "i",playerid);

set the "true" to "false"

true - repeat the timer
false - dont repeat the timer
But i want fire's to repeat!
Reply
#4

Didn't work. The message appear again ,and if i destry the firt fire , after the message the fire start so fast at 2 houses
Look:http://imgur.com/a/ZXf4f
Reply
#5

Kill FireTimer[playerid] timer once the player has Extingushed the Fire?
Reply
#6

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Kill FireTimer[playerid] timer once the player has Extingushed the Fire?
were i need to put Kill FireTimer[playerid]; ?
Reply
#7

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)
instead of
Код:
 DestroyObject(FireObject[playerid])
so if you have taken that Object as a MAX_PLAYERS object, remove that. again, read my whole http://forum.sa-mp.com/showpost.php?...tcount=8"]post to make it clear buddy.
Reply
#8

Quote:
Originally Posted by GTLS
Посмотреть сообщение
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)
instead of
Код:
 DestroyObject(FireObject[playerid])
so if you have taken that Object as a MAX_PLAYERS object, remove that. again, read my whole http://forum.sa-mp.com/showpost.php?...tcount=8"]post to make it clear buddy.
I changed how you say, but oance the first fire is up all is normal, after i extinguishing the fire the second fire start with 2 fires and the message automaticly appear, the thirs fire start with 3 fires and again, again! Help me please.
Reply
#9

Show the whole code you wrote. ill help you.
Reply
#10

So you PMed me your code. ill display the main code here.

PHP код:
public RandFireTimer(playerid)
{
    new 
random(56),string[128];
     
FireObject CreateObject(18691HouseInfo[a][hEntrancex],HouseInfo[a][hEntrancey],HouseInfo[a][hEntrancez],0,0,0);
    foreach(
Playeri)
    {
        if(
Isparamedic(i))
        {
            
SendClientMessage(iCOLOR_LIGHTRED"---Fire Dispatch ---");
             
format(stringsizeof(string), "Fire Was Seen at %s`s House.",HouseInfo[a][hOwner]);
             
SendClientMessage(i,COLOR_LIGHTREDstring);
             
SendClientMessage(i,COLOR_LIGHTRED"Please Fire Fighters Respond to the call.");
            
SetPlayerCheckpoint(iHouseInfo[a][hEntrancex],HouseInfo[a][hEntrancey],HouseInfo[a][hEntrancez],5);
            
CP[i] = 1RespondedToFire[i] = 1;
        }
       }
       return 
1;
}
public 
PuttingOutFire(playerid)
{
    if(
RespondedToFire[playerid] == 1)
    {
        new 
random(56);
        
DestroyObject(FireObject[playerid]);
        if(
IsPlayerInRangeOfPoint(playerid4,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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)