Limit spawned cars - 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: Limit spawned cars (
/showthread.php?tid=109243)
Limit spawned cars -
RedFusion - 18.11.2009
Hey..
How do i fix my vehicle spawner to only spawn one vehicle at time? i mean, if i
-leave my spawned vehicle, and spawn a new one, the old is supposed to dissapear, how do i script this?
Thanks /Red
Re: Limit spawned cars -
LarzI - 18.11.2009
use DestroyVehicle before CreateVehicle
My method is making a var for the playervehicle
pawn Код:
//global
new pVeh[MAX_PLAYERS] = -1;
The reason why I'm giving the var the '-1' value, is that 0 would make a vehicle ID, so it can't be used.
Then do:
pawn Код:
if(pVeh[playerid] != -1) //You might wanna throw in a check if player is inside the vehicle too, but it's not that important
DestroyVehicle(pVeh[playerid]);
//rest of command here
Good luck!
Re: Limit spawned cars -
RedFusion - 18.11.2009
i am new in scripting, and i don't really know what to copy..
Re: Limit spawned cars -
LarzI - 18.11.2009
You sure are new to scripting.
You shouldn't copy anything.
Just read, "explore" and try to understand, then you can do it yourself
Re: Limit spawned cars -
RedFusion - 19.11.2009
I have wrote that script code you did, but the vehicles still stays when i spawn a new one..
Help?