SA-MP Forums Archive
help +REP - 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)
+--- Thread: help +REP (/showthread.php?tid=580454)



help +REP - noamch1997 - 05.07.2015

this is up: http://prntscr.com/7p2nvp

OnPCText:http://prntscr.com/7p2obq

Public:http://prntscr.com/7p2p02

When im adding it i get pawn stop working :/


Thank you very much !


Re: help +REP - dusk - 05.07.2015

Lets start with your SetCarDiscOn definition. It starts a timer but only passes one argument to it but on PCarDisco you add a second parameter. It also doesn't store the timer ID anywhere which means you can never stop it and it is a repeating timer!

Why do you want to use a define? A function would make a lot more sense for it:

pawn Код:
new DiscoTimer[ MAX_VEHICLES ], bool:Disco[ MAX_VEHICLES ]; // a global variable.

TurnCarDiscOn(playerid, vehicleid, message[])
{
     SendClientMessage(playerid, green, message);
     Disco[ vehicleid ] = true;
     DiscoTimer[ vehicleid ] = SetTimerEx("PCarDisco", 200, 1, "i", vehicleid);
}
TurnCarDiscOff(playerid, vehicleid, message[])
{
     SendClientMessage(playerid, green, message);
     Disco[ vehicleid ] = false;
     KillTimer(DiscoTimer[ vehicleid ]);
}
forward PCarDisco(vehicleid);
public PCarDisco(vehicleid)
{
     if(Disco[ vehicleid ] == true)
     {
          // change the colour.
     }
}
I also changed the Disco array. I used vehicleid for its index... Its still not quite right. The TurnCarDiscOn/Off shouldn't even need a playerid argument...


Re: help +REP - noamch1997 - 05.07.2015

thanks bro I will try this