PDA

View Full Version : help +REP


noamch1997
05/07/2015, 03:25 PM
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 !

dusk
05/07/2015, 04:00 PM
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:



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...

noamch1997
05/07/2015, 11:56 PM
thanks bro I will try this