SA-MP Forums Archive
Spawn vehicle when key is pressed - 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: Spawn vehicle when key is pressed (/showthread.php?tid=509404)



Spawn vehicle when key is pressed - Steve1312 - 26.04.2014

So i am wondering how i can do this.
When player is entered specific place and enters specific command he gots in spec mode and vehicle spawns.(i know how to make this)

But i can make when he press KEY_LEFT spawns another car but old one deletes from that place?
Thanks i have tried some things but they crashed my server or didn't even worked.So i removed it.

Thanks.


Re: Spawn vehicle when key is pressed - PrinceKumar - 26.04.2014

Create two new variable you can named it as u want for example :
new mVehicle[MAX_PLAYERS];
new nVehicle[MAX_PLAYERS];
// now go under any callback where u wanna to call ur function here i will like to call my function under onplayerenterindyanmicarea(or whatever it is) callback
//here u also need some conditions , here think i have an specified area name mzone
// here only for example
if(getPlayerDynamicArea(playerid,mZone))
{
if(pressedkey == LEFT)
{
nVehicle[playerid] = CreateVehicle(...);
DestroyVehicle(mVehicle[playerid]);
}
}
note : it is a example which i m giving n functions are differ from actual functions


Re: Spawn vehicle when key is pressed - Steve1312 - 26.04.2014

Okay and now i am a bit confused.
How script will know that mVehicle is old vehicle id?


Re: Spawn vehicle when key is pressed - Matess - 26.04.2014

Check fsdebug.pwn in standard filterscript folder in default samp-server folder. Command /vsel is what you need


Re: Spawn vehicle when key is pressed - Steve1312 - 26.04.2014

Realy big thank you Matess