SA-MP Forums Archive
Need help creating Timers. - 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: Need help creating Timers. (/showthread.php?tid=346113)



Need help creating Timers. - [MM]RoXoR[FS] - 27.05.2012

I am creating a mode in which Player gets a car after killing some players.
It workes fine.

Now I want to destroy his/her car after 2 minutes.
I have already created array to give player his/her own car.

Here is code for better understanding

Код:
forward DestroyCar(playerid);
{
pCar[playerid] = CreateVehicle(bla bla);
//SetTimer("DestroyCar",12000,false); for 2 minutes here
}

//After 2 Minutes
public DestroyCar(playerid)
{
DestroyVehicle(pCar[playerid]);//Car should be destroyed of that particular player only.
}



Re: Need help creating Timers. - Yuryfury - 27.05.2012

You have to use SetTimerX and forward the playerid as well.

pawn Код:
SetTimerEx("DestroyCar",12000,false, "i", playerid);
// the i specifies the type of value you are forwarding (i for integer)
// playerid is the value of i to forward



Re: Need help creating Timers. - mprofitt - 27.05.2012

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
I am creating a mode in which Player gets a car after killing some players.
It workes fine.

Now I want to destroy his/her car after 2 minutes.
I have already created array to give player his/her own car.

Here is code for better understanding

Код:
forward DestroyCar(playerid);
{
pCar[playerid] = CreateVehicle(bla bla);
//SetTimer("DestroyCar", 12000, false); for 2 minutes here
}

//After 2 Minutes
public DestroyCar(playerid)
{
DestroyVehicle(pCar[playerid]);//Car should be destroyed of that particular player only.
}
pawn Код:
SetTimerEx("DestroyCar", 12000, false, "d", playerid);



Re: Need help creating Timers. - Revo - 27.05.2012

pawn Код:
SetTimerEx("DestroyCar",12000,false,"i",playerid);