Limit spawned cars
#1

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
Reply
#2

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!
Reply
#3

i am new in scripting, and i don't really know what to copy..
Reply
#4

You sure are new to scripting.
You shouldn't copy anything.
Just read, "explore" and try to understand, then you can do it yourself
Reply
#5

I have wrote that script code you did, but the vehicles still stays when i spawn a new one..
Help?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)