Like there's a garage under the cummings building, we /enter and go down there, and /exit with a vehicle, how do I script that?
I tried google and youtube but nothing worked.
Thanks in advance :]
If you already have an account with us, please use the login panel below to access your account.
Like there's a garage under the cummings building, we /enter and go down there, and /exit with a vehicle, how do I script that?
I tried google and youtube but nothing worked.
Thanks in advance :]
Former Head Administrator
Former Lead Developer
Programmer/Web Developer
SA-MP Scripter since 2008
Tonight, tonight! Off with his head!
Playing CSGO, VM me your ID so we can play :D
Talk to me if you want the surname
HTML Code:old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]
Updated
Spoiler!
Do you just want the code or are you intrested in how to do it?
Ex-LSPD R4(TDB(Founded)/T&R) || Ex-LSPD R4(HSIU/IA/PWC/ADM/TDB) || Ex-SANG R4(RnT Commander/IA) || FBI R2(CID/NSB) || Ex-LSFMD R0 || Beta-Tester, NA Recruitment || Community Helper[spoiler]The original TDB.
http://www.youtube.com/watch?v=0cgOt...layer_embedded[/spoiler]
vBy :MILK:v
Playing CSGO, VM me your ID so we can play :D
Talk to me if you want the surname
HTML Code:old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]
Updated
Spoiler!
K gimmi a sec in the movies(2 guns :D)
Ex-LSPD R4(TDB(Founded)/T&R) || Ex-LSPD R4(HSIU/IA/PWC/ADM/TDB) || Ex-SANG R4(RnT Commander/IA) || FBI R2(CID/NSB) || Ex-LSFMD R0 || Beta-Tester, NA Recruitment || Community Helper[spoiler]The original TDB.
http://www.youtube.com/watch?v=0cgOt...layer_embedded[/spoiler]
vBy :MILK:v
Got /enter and /exit working, and other commands work as well, now vehicle part, I can't find it, so tell me what to add in script so if I /enter or /exit, I stay on vehicle :]
Playing CSGO, VM me your ID so we can play :D
Talk to me if you want the surname
HTML Code:old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]
Updated
Spoiler!
Doing vehicles, is a little bit of a tricky part, especially when you also wanna work with virtual worlds (as I did with my garage system.)
So - first off all, you need to know if the player is in a vehicle or not - we'll approach this simply and efficient by the following code: (ZCMD based)
So, basically we know if the player is in a vehicle or not - after that, it's familair to the normal enter/exit method, except for some things, check it out.Code:CMD:enter(playerid, params[]){ if(IsPlayerConnected(playerid)){ if(IsPlayerInAnyVehicle(playerid)){ //A.K.A: The player is trying to enter the point while in a vehicle. }else{ //The player is not inside any vehicle, and we just set him at the wanted position. } } }
There we go, thats all we need to do. (Quick note: The SetVehiclePos will also take the players which are in the vehicle along with it - so no need to worry about that.)Code:CMD:enter(playerid, params[]){ if(IsPlayerConnected(playerid)){ if(IsPlayerInAnyVehicle(playerid)){ new vhid = GetPlayerVehicleID(playerid); SetVehiclePos(vhid, x, y, z); //x, y, and z should be overwritten by the wanted position. }else{ //The player is not inside any vehicle, and we just set him at the wanted position. } } }
Lil' extension - if you wanna work with virtual words, this'll take a lil bit longer - i'll write this done, just incase you are interested.
NOTE: I heavly suggest you to use the Foreach loops by YLess, check it out - it's a better and faster way of looping through vehicles and players.Code:CMD:enter(playerid, params[]){ if(IsPlayerConnected(playerid)){ if(IsPlayerInAnyVehicle(playerid)){ new vhid = GetPlayerVehicleID(playerid); SetVehiclePos(vhid, x, y, z); SetVehicleVirtualWorld(vhid, vw); //vw has to be overwritten by the wanted vw ofcourse. for(p = 0; p < MAX_PLAYERS; p++){ if(IsPlayerConnected(p)){ if(IsPlayerInAnyVehicle(p)){ if(GetPlayerVehicleID(playerid) == vhid){ SetPlayerVirtualWorld(playerid, vw); //vw has to be overwritten by the wanted vw. } } } } }else{ //The player is not inside any vehicle, and we just set him at the wanted position. } } }
That's it - you can also work with interiors if you like, but i'm not gonna write this all down if you aint using it.
Codes were written out of my head, if anything is not working, feel free to vm/pm me same for any more help or trouble you are experiencing.
Last edited by James; 5th August 2013 at 03:51 PM.
Spoiler!
Awaiting player's response for 24 hours.
If anyone needs me, I'm most likely on discord.
Spoiler!
"The truth is like poetry-- And most people fucking hate poetry," - Overheard in a Washington D.C. bar by Michael Lewis, author of The Big Short
<iframe width="560" height="315" src="https://www.youtube.com/embed/hNMZGSzB7EI" frameborder="0" allowfullscreen></iframe>
You may close this, thanks Byte and James for your time.
I'm gonna try these things out. :]
Playing CSGO, VM me your ID so we can play :D
Talk to me if you want the surname
HTML Code:old sig link for if I want to change back[img]http://i.imgur.com/McYskY2.png[/img]
Updated
Spoiler!
Answered and archived.
If anyone needs me, I'm most likely on discord.
Spoiler!
"The truth is like poetry-- And most people fucking hate poetry," - Overheard in a Washington D.C. bar by Michael Lewis, author of The Big Short
<iframe width="560" height="315" src="https://www.youtube.com/embed/hNMZGSzB7EI" frameborder="0" allowfullscreen></iframe>