Timers
#1

I Hey guys,

I need some help I am working on a fire script with timers, I am having some errors so can someone help me.
I have used #define timer1, new timer1 etc for all the codes

Here is all the commands, with fire codes and timers:

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/fire 1", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, 0xFFFF0096, "[INFO]: You have made a fire at Jim's Sticky Donut Shop!");
		CreateExplosion(1031.97, -1341.56, 18.14, 2, 10.0);
		CreateExplosion(1038.03, -1338.12, 13.13, 2, 10.0);
		CreateExplosion(1020.90, -1335.49, 13.13, 2, 10.0);
		CreateExplosion(1042.35, -1338.17, 13.13, 2, 10.0);
		CreateExplosion(1037.35, -1334.80, 13.13, 2, 10.0);
		CreateExplosion(1041.36, -1335.49, 13.13, 2, 10.0);
		CreateExplosion(1045.41, -1339.77, 13.13, 2, 10.0);
		CreateExplosion(1044.24, -1343.51, 13.13, 2, 10.0);
		CreateExplosion(1047.80, -1343.52, 13.13, 2, 10.0);
		CreateExplosion(1045.99, -1348.87, 13.13, 2, 10.0);
		CreateExplosion(1047.05, -1355.08, 13.13, 2, 10.0);
		CreateExplosion(1044.26, -1355.63, 13.13, 2, 10.0);
		CreateExplosion(1037.96, -1357.76, 18.14, 2, 10.0);
		CreateExplosion(1034.20, -1356.78, 18.14, 2, 10.0);
		CreateExplosion(1036.80, -1353.89, 18.14, 2, 10.0);
		CreateExplosion(1039.93, -1355.90, 18.14, 2, 10.0);
		CreateExplosion(1033.30, -1353.39, 18.14, 2, 10.0);
		CreateExplosion(1035.62, -1350.44, 18.14, 2, 10.0);
		CreateExplosion(1038.73, -1351.40, 18.14, 2, 10.0);
		CreateExplosion(1032.51, -1349.24, 18.14, 2, 10.0);
		CreateExplosion(1037.11, -1345.62, 18.14, 2, 10.0);
		CreateExplosion(1033.98, -1343.83, 18.14, 2, 10.0);
		CreateExplosion(1031.75, -1346.19, 18.14, 2, 10.0);
		CreateExplosion(1033.62, -1338.59, 13.13, 2, 10.0);
		CreateExplosion(1028.62, -1334.72, 13.13, 2, 10.0);
		CreateExplosion(1024.21, -1338.77, 13.13, 2, 10.0);
		CreateExplosion(1026.21, -1344.08, 13.13, 2, 10.0);
		CreateExplosion(1027.78, -1338.49, 13.13, 2, 10.0);
		CreateExplosion(1023.44, -1343.16, 13.13, 2, 10.0);
		CreateExplosion(1023.88, -1347.60, 13.13, 2, 10.0);
		CreateExplosion(1026.95, -1349.15, 13.13, 2, 10.0);
		CreateExplosion(1024.25, -1351.92, 13.13, 2, 10.0);
		CreateExplosion(1026.78, -1352.79, 13.13, 2, 10.0);
		CreateExplosion(1024.47, -1355.64, 13.13, 2, 10.0);
		CreateExplosion(1027.46, -1358.11, 13.13, 2, 10.0);
		CreateExplosion(1017.32, -1354.22, 13.13, 2, 10.0);
		CreateExplosion(1019.75, -1349.07, 13.13, 2, 10.0);
		CreateExplosion(1019.88, -1342.60, 13.13, 2, 10.0);
		CreateExplosion(1015.12, -1343.06, 13.13, 2, 10.0);
		CreateExplosion(1016.11, -1348.21, 13.13, 2, 10.0);
    	timer1 = SetTimer("message", 9000, false);
		return 1;
	}
	if (strcmp("/fire 2", cmdtext, true, 10) == 0)
	{
	    SendClientMessage(playerid, 0xFFFF0096, "[INFO]: You have made a fire at the LSPD!");
	    CreateExplosion(1528.44, -1692.15, 13.03, 2, 10.0);
	    CreateExplosion(1544.74, -1664.36, 13.38, 2, 10.0);
	    CreateExplosion(1544.36, -1659.02, 13.38, 2, 10.0);
	    CreateExplosion(1542.46, -1672.30, 13.03, 2, 10.0);
	    CreateExplosion(1541.66, -1677.38, 13.03, 2, 10.0);
	    CreateExplosion(1540.58, -1683.86, 13.03, 2, 10.0);
	    CreateExplosion(1544.65, -1684.12, 13.03, 2, 10.0);
	    CreateExplosion(1542.47, -1692.67, 13.03, 2, 10.0);
	    CreateExplosion(1539.99, -1696.19, 13.03, 2, 10.0);
	    CreateExplosion(1538.84, -1660.46, 13.03, 2, 10.0);
	    CreateExplosion(1531.79, -1660.07, 13.03, 2, 10.0);
	    CreateExplosion(1527.13, -1667.13, 13.03, 2, 10.0);
	    CreateExplosion(1533.62, -1668.31, 13.03, 2, 10.0);
	    CreateExplosion(1529.00, -1677.87, 13.03, 2, 10.0);
	    CreateExplosion(1532.72, -1685.81, 13.03, 2, 10.0);
	    CreateExplosion(1537.97, -1692.67, 13.03, 2, 10.0);
	    timer2 = SetTimer("message", 9000, false);
		return 1;
	}
	if (strcmp("/fire 3", cmdtext, true, 10) == 0)
	{
	    SendClientMessage(playerid, 0xFFFF0096, "[INFO]: You have made a fire at Ocean Docks!");
	    CreateExplosion(2460.96, -2575.50, 15.69, 2, 10.0);
	    CreateExplosion(2473.78, -2578.83, 13.25, 2, 10.0);
	    CreateExplosion(2468.39, -2578.61, 13.25, 2, 10.0);
	    CreateExplosion(2467.10, -2583.48, 13.25, 2, 10.0);
	    CreateExplosion(2473.91, -2585.07, 13.25, 2, 10.0);
	    CreateExplosion(2480.51, -2579.02, 13.25, 2, 10.0);
	    CreateExplosion(2472.48, -2573.93, 13.25, 2, 10.0);
	    CreateExplosion(2468.27, -2589.17, 13.25, 2, 10.0);
	    CreateExplosion(2466.42, -2574.72, 15.69, 2, 10.0);
	    CreateExplosion(2461.72, -2572.58, 15.69, 2, 10.0);
	    timer3 = SetTimer("message", 9000, false);
	    return 1;
	}
	if (strcmp("/fire 4", cmdtext, true, 10) == 0)
	{
	    SendClientMessage(playerid, 0xFFFF0096, "[INFO]: You have made a fire at Market Street!");
	    CreateExplosion(1284.6012, -1585.5769, 13.5469, 2, 10.0);
        CreateExplosion(1284.6012, -1585.5769, 13.5469, 2, 10.0);
        CreateExplosion(1284.6012, -1585.5769, 13.5469, 2, 10.0);
        CreateExplosion(1284.6012, -1585.5769, 13.5469, 2, 10.0);
        CreateExplosion(1284.6012, -1585.5769, 13.5469, 2, 10.0);
        CreateExplosion(1284.6012, -1585.5769, 13.5469, 2, 10.0);
        timer4 = SetTimer("message", 9000, false);
        return 1;
	}
	if (strcmp("/fire 5", cmdtext, true, 10) == 0)
	{
	    SendClientMessage(playerid, 0xFFFF0096, "[INFO]: You have made a fire at Norht Rock (Forest fire)!");
	    CreateExplosion(2382.74, -687.93, 127.88, 2, 10.0);
	    CreateExplosion(2390.30, -692.88, 125.68, 2, 10.0);
	    CreateExplosion(2396.90, -685.01, 126.08, 2, 10.0);
	    CreateExplosion(2402.79, -684.95, 126.08, 2, 10.0);
	    CreateExplosion(2393.56, -671.92, 126.93, 2, 10.0);
	    CreateExplosion(2385.86, -671.07, 127.03, 2, 10.0);
	    CreateExplosion(2409.08, -669.92, 127.03, 2, 10.0);
	    CreateExplosion(2381.75, -700.96, 127.03, 2, 10.0);
	    CreateExplosion(2396.37, -700.81, 123.83, 2, 10.0);
	    CreateExplosion(2402.97, -695.81, 124.34, 2, 10.0);
	    CreateExplosion(2406.50, -693.37, 124.45, 2, 10.0);
	    CreateExplosion(2405.86, -705.05, 124.45, 2, 10.0);
	    CreateExplosion(2397.51, -692.40, 125.31, 2, 10.0);
	    timer5 = SetTimer("message", 9000, false);
	    return 1;
	}
	if (strcmp("/stopfire", cmdtext, true, 10) == 0)
	{
	    SendClientMessage(playerid, 0xFFFF0096, "[INFO]: You have stopped the timmers in the fire!");
	    KillTimer(timer1);
	    KillTimer(timer2);
	    KillTimer(timer3);
	    KillTimer(timer4);
	    KillTimer(timer5);
	    return 1;
 	}
	return 0;
}
Reply
#2

What is the error line?
Reply
#3

Код:
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(36) : warning 235: public function lacks forward declaration (symbol "message")
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(86) : error 017: undefined symbol "timer1"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(108) : error 017: undefined symbol "timer2"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(124) : error 017: undefined symbol "timer3"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(136) : error 017: undefined symbol "timer4"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(155) : error 017: undefined symbol "timer5"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(161) : error 017: undefined symbol "timer1"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(162) : error 017: undefined symbol "timer2"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(163) : error 017: undefined symbol "timer3"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(164) : error 017: undefined symbol "timer4"
C:\Users\Calum Smith\Desktop\SA-MP Server 0.3e\filterscripts\fires.pwn(165) : error 017: undefined symbol "timer5"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


10 Errors.
Reply
#4

pawn Код:
forward message();
And you need
pawn Код:
new timer1, timer2, timer3, timer4, timer5;
Reply
#5

still don't work
Reply
#6

Delete the part from your script where you #define timer1.
Reply
#7

I have but it still doesn't work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)