Destroy Vehicle Problem - 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: Destroy Vehicle Problem (
/showthread.php?tid=294189)
Destroy Vehicle Problem -
Kostas' - 31.10.2011
Hello, I have
pawn Код:
OnPlayerExitVehicle(playerid, vehicleid)
a timer and when the driver exit the vehicle, the vehicle will be destroy.
The problem is, that if the driver exit vehicle, and there are passenger in the vehicle, the vehicle still destroyed.
How can I make it, so when the driver exit vehicle, to check if there are passenger in the vehicle. If not the car will be destroyed, if else there are passengers in the vehicle to wait all passenger exit vehicle and then destroyed.
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(GetPlayerState(playerid)==PLAYER_STATE_DRIVER) {
DestroyVehicle(vehicleid);
}
SetTimerEx("cardestroyedhide", 5000, 0, "i", vehicleid);//
}
Re: Destroy Vehicle Problem -
Gustavob - 31.10.2011
Try checking if is there anyone in the vehicle at all (a basic player
for loop or
foreach +
IsPlayerInVehicle) and, if so, only then
destroy the vehicle
Or the post below if this doesn't work
Re: Destroy Vehicle Problem -
=WoR=G4M3Ov3r - 31.10.2011
You can also use PLAYER_STATE_PASSENGER, and toggle the vehicle from respawning if the player's state is as a passenger.
Re: Destroy Vehicle Problem -
Kostas' - 31.10.2011
Can you explain me because I didn't understand it.
Also, can you give me an example on this. I tried something with foreach but I failed.
@=WoR=G4M3Ov3r, How can I toggle the vehicle from respawning if the player's state is as a passenger