What is wrong with this code? Please Help! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What is wrong with this code? Please Help! (
/showthread.php?tid=239449)
What is wrong with this code? Please Help! -
Tommy_Mandaz - 13.03.2011
Hey,
I wanna fix my fire command since its not working, pretty much it creates fire objects but I cant seem to get it to put them out here is what I have under the command to create the fires:
Код:
fire1 = CreateObject(18691, x+10, y+0, z-1, fax, fay, faz);
fire2 = CreateObject(18691, x+10, y+2, z-1, fax, fay, faz);
fire3 = CreateObject(18691, x+10, y-2, z-1, fax, fay, faz);
fire4 = CreateObject(18691, x+10, y+4, z-1, fax, fay, faz);
fire5 = CreateObject(18691, x+10, y-4, z-1, fax, fay, faz);
SetTimer("spraycheck", 5000, 1);
Then I have this under the timer:
Код:
if(GetPlayerCameraFrontVector(playerid, x, y, z) == fire1 && weaponid == 42 || GetPlayerCameraFrontVector(playerid, x, y, z) == fire2 && weaponid == 42 || GetPlayerCameraFrontVector(playerid, x, y, z) == fire3 && weaponid == 42 || GetPlayerCameraFrontVector(playerid, x, y, z) == fire4 && weaponid == 42 || GetPlayerCameraFrontVector(playerid, x, y, z) == fire5 && weaponid == 42)
{
if(newkeys & KEY_FIRE)
{
SetTimer("sprayputout", 10000, 1);
SendClientMessage(playerid, COLOR_GREEN, "You begin to put out the fire...");
Then under that timer I have:
Код:
DestroyObject(fire1);
DestroyObject(fire2);
DestroyObject(fire3);
DestroyObject(fire4);
DestroyObject(fire5);
Why isnt it removing that fire objects once the person sprays them with the extinguisher? Please Help Thanks!
Also when I compile it I get no errors but it creates the fires but I cant put them out...
Re: What is wrong with this code? Please Help! -
Medal Of Honor team - 13.03.2011
SetTimer("sprayputout", 10000, 1); // why have you give repeat true?
Try this
SetTimer("sprayputout", 10000, 0);
Re: What is wrong with this code? Please Help! -
Tommy_Mandaz - 13.03.2011
Same result, anyone else please help me?