Why doesn`t Vehicle delete when I pick up pickup?. - 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: Why doesn`t Vehicle delete when I pick up pickup?. (
/showthread.php?tid=341997)
Why doesn`t Vehicle delete when I pick up pickup?. -
Audi_Quattrix - 12.05.2012
This is my script,I want it to delete previous spawned vehicle before spawning new one but it is not working.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == infernuspickup)
{
new Float:X,Float:Y,Float:Z,vehicle[MAX_PLAYERS];
GetPlayerPos(playerid,X,Y,Z);
DestroyVehicle(vehicle[playerid]);
vehicle[playerid] = CreateVehicle(411,X,Y,Z,0,0,0,-1);
PutPlayerInVehicle(playerid,vehicle[playerid], 0);
return 1;
}
return 1;
}
Re: Why doesn`t Vehicle delete when I pick up pickup?. -
Vince - 12.05.2012
You're creating the variable locally, which means that it gets wiped when the function is done executing. Try changing
new to
static, that might work.
Re: Why doesn`t Vehicle delete when I pick up pickup?. -
Audi_Quattrix - 12.05.2012
Works...Thank You! Rep+ from me