SA-MP Forums Archive
Car Destroy With SetTimter - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Car Destroy With SetTimter (/showthread.php?tid=261816)



Car Destroy With SetTimter - kelvin22 - 15.06.2011

Hello!
I need some help to make a car destroy with settimter.
I make a car destroy with time but it not work it wher a player stay 15 sec in a car in auto exit player from vehicles:

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
	{
	new vid = GetPlayerVehicleID(playerid);
 	SetTimerEx("destroy", 15000, false, "d", vid);
	}
	return 1;
}

forward destroy(vid);
public destroy(vid)
{
	DestroyVehicle(vid);
	return 1;
}
Thanks!


Re: Car Destroy With SetTimter - Wesley221 - 15.06.2011

So, if im right: If youre in a car, and after 15 seconds in the car, it needs to be destroyed?
Or: If youre in a car, and leave the car, wait 15 seconds, the car needs to be destroyed?


Re: Car Destroy With SetTimter - kelvin22 - 15.06.2011

Yes if a player in any car and player leave car it need to destroy car


Re: Car Destroy With SetTimter - Wesley221 - 15.06.2011

pawn Код:
AddStaticVehicleEx(carid, x, y, z, a, 15 /* Respawntime in seconds */ );
CreateVehicle(carid, x, y, z, a, 15 /* Respawntime in seconds aswell */ );
Use one of those, not sure if you can do it with the timer


Re: Car Destroy With SetTimter - King Ace - 15.06.2011

pawn Код:
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
Should be:
pawn Код:
if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)



Re: Car Destroy With SetTimter - kelvin22 - 15.06.2011

Ok, i go to try


Re: Car Destroy With SetTimter - kelvin22 - 15.06.2011

Now it is better but Timer not work :
Quote:

SetTimerEx("destroy", 15000, false, "d", vid);




Re: Car Destroy With SetTimter - Sasino97 - 15.06.2011

I think the "forward" should come before settimer.
Place it at the start of the script.