SA-MP Forums Archive
Spawned Car ......... - 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: Spawned Car ......... (/showthread.php?tid=516335)



Spawned Car ......... - GeekSiMo - 30.05.2014

I got A problem, When A player spawn a car/bike/plane with a command (/car)(/v)(acar)(vcar), the car stay always at the place where he spawned it!!!


Re: Spawned Car ......... - kamiliuxliuxliux - 30.05.2014

Yea, the same thing was with my GM.
Just set a variable to store created vehicle's ID
new veh = CreateVehicle(...)

And under OnVehicleSpawn put
if(vehicleid == veh) DestroyVehicle(...)

+ rep if helped



Re: Spawned Car ......... - GeekSiMo - 30.05.2014

Ok Thanks i will try it !!


Re: Spawned Car ......... - kamiliuxliuxliux - 30.05.2014

BTW, set variable veh as global and for each player new veh[MAX_PLAYERS]
And use it with veh[playerid]



Re: Spawned Car ......... - GeekSiMo - 30.05.2014

I don't understand ?


Re: Spawned Car ......... - GeekSiMo - 30.05.2014

I want Spawned Cars Automatic Destroyable ??


AW: Spawned Car ......... - Macronix - 30.05.2014

Here:
pawn Код:
//above main()
new SpawnedCar[MAX_PLAYERS];

//in your spawn command:
SpawnedCar[playerid] = CreateVehicle(...);

//in OnVehicleSpawn or OnVehicleDeath
if(vehicleid == SpawnedCar[playerid])
{
    DestroyVehicle(SpawnedCar[playerid]);
}



Re: Spawned Car ......... - GeekSiMo - 31.05.2014

i want to set timer to destroy spawned vehicle


Re: Spawned Car ......... - BroZeus - 31.05.2014

pawn Код:
forward Destroy(vid);//on top
public Destroy(vid)
{
DestroyVehicle(vid);
return 1;
}


//now this in where you spawn car
new id;
id = CreateVehicle(....);
SetTimerEx("Destroy",1000*60*2/*2mins*/,false,"i",id);



Re: Spawned Car ......... - GeekSiMo - 31.05.2014

Thanks Everybody !!