Destroy Vehicle After Spawn Another One - 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 After Spawn Another One (
/showthread.php?tid=444319)
Destroy Vehicle After Spawn Another One -
wasabi1798 - 16.06.2013
look at this script:
emenu.pwn
i got this script from this forum. it's called EMenu.
the script works great but i need this script to destroy vehicle after i spawned another one.
(btw i don't know anything about scripting.)
can anyone edit the scirpt so the script destroy vehicle after a layer spawned another one?
also, don't bother giving me other FS coz i want to use this one on my server.
thanks
AW: Destroy Vehicle After Spawn Another One -
Skimmer - 16.06.2013
The script is really messy.
But you can save the vehicle ID in a variable and remove it after spawn another one.
pawn Код:
new SpawnedVehicle[MAX_PLAYERS];
if(IsValidVehicle(SpawnedVehicle[playerid]))
DestroyVehicle(SpawnedVehicle[playerid]);
SpawnedVehicle[playerid] = CreateVehicle(...);
Important! Don't forgot to reset the variable and remove the vehicle after the player leaves the server.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
if(IsValidVehicle(SpawnedVehicle[playerid]))
DestroyVehicle(SpawnedVehicle[playerid]);
SpawnedVehicle[playerid] = INVALID_VEHICLE_ID;
return 1;
}
The function
IsValidVehicle is not defined in a_samp include, because of that don't forgot to add.
pawn Код:
native IsValidVehicle(vehicleid);
Top of your script.
Re: AW: Destroy Vehicle After Spawn Another One -
wasabi1798 - 17.06.2013
Quote:
Originally Posted by MouseBreaker
The script is really messy.
But you can save the vehicle ID in a variable and remove it after spawn another one.
pawn Код:
new SpawnedVehicle[MAX_PLAYERS];
if(IsValidVehicle(SpawnedVehicle[playerid])) DestroyVehicle(SpawnedVehicle[playerid]); SpawnedVehicle[playerid] = CreateVehicle(...);
Important! Don't forgot to reset the variable and remove the vehicle after the player leaves the server.
pawn Код:
public OnPlayerDisconnect(playerid, reason) { if(IsValidVehicle(SpawnedVehicle[playerid])) DestroyVehicle(SpawnedVehicle[playerid]); SpawnedVehicle[playerid] = INVALID_VEHICLE_ID; return 1; }
The function IsValidVehicle is not defined in a_samp include, because of that don't forgot to add.
pawn Код:
native IsValidVehicle(vehicleid);
Top of your script.
|
umm i don't understand the part
pawn Код:
SpawnedVehicle[playerid] = CreateVehicle(...);
what should i put in the (...) ?
Re: Destroy Vehicle After Spawn Another One -
wasabi1798 - 21.06.2013
bump
Re: Destroy Vehicle After Spawn Another One -
xFirex - 21.06.2013
CreateVehicle(520, Float

,Float:y,Float:z, Float:Angle, 0, 1, Float:timerespawn);
https://sampwiki.blast.hk/wiki/CreateVehicle