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



Timer Help - Thresholdold - 30.11.2011

I just wanted to know how I can create a timer, so every 20 seconds... it will add vehicle component to a certain car.

Код:
	new comp = AddVehicleComponent(tsultan,1026),
	AddVehicleComponent(tsultan,1027),
	AddVehicleComponent(tsultan,1028),
	AddVehicleComponent(tsultan,1032),
	AddVehicleComponent(tsultan,1098),
	AddVehicleComponent(tsultan,1010),
	AddVehicleComponent(tsultan,1138),
	AddVehicleComponent(tsultan,1141),
	AddVehicleComponent(tsultan,1169),
	ChangeVehiclePaintjob(tsultan, 0),
	AddVehicleComponent(gelegy, 1035),
	AddVehicleComponent(gelegy, 1037),
	AddVehicleComponent(gelegy, 1039),
	AddVehicleComponent(gelegy, 1046),
	AddVehicleComponent(gelegy, 1048),
	AddVehicleComponent(gelegy, 1172),
	AddVehicleComponent(gelegy, 1096),
	ChangeVehiclePaintjob(gelegy, 1);
I want the component to reload every 20 seconds, please help me


Re: Timer Help - Tanush123 - 30.11.2011

OnPlayerConnect add
pawn Код:
SetTimerEx("AddMod",20000,true,"i",playerid);
Then at the end of ur pawno add
pawn Код:
forward AddMod(playerid);
public AddMod(playerid)
{
        new comp = AddVehicleComponent(tsultan,1026),
    AddVehicleComponent(tsultan,1027),
    AddVehicleComponent(tsultan,1028),
    AddVehicleComponent(tsultan,1032),
    AddVehicleComponent(tsultan,1098),
    AddVehicleComponent(tsultan,1010),
    AddVehicleComponent(tsultan,1138),
    AddVehicleComponent(tsultan,1141),
    AddVehicleComponent(tsultan,1169),
    ChangeVehiclePaintjob(tsultan, 0),
    AddVehicleComponent(gelegy, 1035),
    AddVehicleComponent(gelegy, 1037),
    AddVehicleComponent(gelegy, 1039),
    AddVehicleComponent(gelegy, 1046),
    AddVehicleComponent(gelegy, 1048),
    AddVehicleComponent(gelegy, 1172),
    AddVehicleComponent(gelegy, 1096),
    ChangeVehiclePaintjob(gelegy, 1);
        return 1;
idk if it would work but try it, i am sure it could


Re: Timer Help - Thresholdold - 30.11.2011

The end of the script looked like this

Код:
forward AddMod(playerid);
	public AddMod(playerid)
	{
	AddVehicleComponent(tsultan,1026);
	AddVehicleComponent(tsultan,1027);
	AddVehicleComponent(tsultan,1028);
	AddVehicleComponent(tsultan,1032);
    AddVehicleComponent(tsultan,1098);
    AddVehicleComponent(tsultan,1010);
    AddVehicleComponent(tsultan,1138);
    AddVehicleComponent(tsultan,1141);
    AddVehicleComponent(tsultan,1169);
    ChangeVehiclePaintjob(tsultan, 0);
    AddVehicleComponent(gelegy, 1035);
    AddVehicleComponent(gelegy, 1037);
    AddVehicleComponent(gelegy, 1039);
    AddVehicleComponent(gelegy, 1046);
    AddVehicleComponent(gelegy, 1048);
    AddVehicleComponent(gelegy, 1172);
    AddVehicleComponent(gelegy, 1096);
    ChangeVehiclePaintjob(gelegy, 1);
    return 1;
 }
Thanks for your help buddy
Rep +1


Respuesta: Re: Timer Help - Super_Panda - 30.11.2011

pawn Код:
SetTimerEx("AddMod",20000,true,"i",playerid);
Then at the end of ur pawno add
pawn Код:
forward AddMod(playerid);
public AddMod(playerid)
{
        new comp = AddVehicleComponent(tsultan,1026),
    AddVehicleComponent(tsultan,1027),
    AddVehicleComponent(tsultan,1028),
    AddVehicleComponent(tsultan,1032),
    AddVehicleComponent(tsultan,1098),
    AddVehicleComponent(tsultan,1010),
    AddVehicleComponent(tsultan,1138),
    AddVehicleComponent(tsultan,1141),
    AddVehicleComponent(tsultan,1169),
    ChangeVehiclePaintjob(tsultan, 0),
    AddVehicleComponent(gelegy, 1035),
    AddVehicleComponent(gelegy, 1037),
    AddVehicleComponent(gelegy, 1039),
    AddVehicleComponent(gelegy, 1046),
    AddVehicleComponent(gelegy, 1048),
    AddVehicleComponent(gelegy, 1172),
    AddVehicleComponent(gelegy, 1096),
    ChangeVehiclePaintjob(gelegy, 1);
        return 1;



Re: Timer Help - Tanush123 - 03.12.2011

Sir, you trying to copy me?


Re: Timer Help - Boooth - 03.12.2011

I believe he is dear sir.


Re: Timer Help - N0FeaR - 03.12.2011

Quote:
Originally Posted by Tanush123
Посмотреть сообщение
Sir, you trying to copy me?
Super_Panda he copy that you type here lol (copycat)


Re: Timer Help - Tanush123 - 08.12.2011

i think that dude has no words to say since he copyed my code.