19.11.2016, 22:16
Hey! This Tutorial's aim is to allow you to make your added vehicles visible in another map (which is usually in another world). There are probably loads of these made, but please, dont hate! Just my first tutorial :P
I will also show you the correct formatting, etc.
This tutorial will be based on the 8 figure track.
WARNING: Please do define #define COLOR_GREEN 0x33AA33AA in your script, unless you wanna type in the numbers.
//-----------//
These may help you
https://sampwiki.blast.hk/wiki/SetPlayerPos
https://sampwiki.blast.hk/wiki/SetPlayerInterior
https://sampwiki.blast.hk/wiki/SendClientMessage
//-----------//
Not every interior/map is interior id 7, francis airport is 14. For more info on that visit
https://sampwiki.blast.hk/wiki/InteriorIDs
So depending on what command processor you wanna use, (I use ZCMD) you wanna make your actual command.
Now we will add a sendclientmessage function.
NOTE: You can #define SCM SendClientMessage , if you are lazy, but this will reduce your understanding of the process.
WARNING!!!!: If you have other teleport commands, make sure to set the virtual worlds for them as 0 (if they are in the main world)
lastly but surely we will finish up with the location.
And thats it! Your code is complete.
Under public OnGameMode(or FilterScript)Init you would have your CreateStaticVehicle(Ex) with your vehicles in there, well, being created!
I hope this tutorial helped you!
I will also show you the correct formatting, etc.
This tutorial will be based on the 8 figure track.
WARNING: Please do define #define COLOR_GREEN 0x33AA33AA in your script, unless you wanna type in the numbers.
//-----------//
These may help you
https://sampwiki.blast.hk/wiki/SetPlayerPos
https://sampwiki.blast.hk/wiki/SetPlayerInterior
https://sampwiki.blast.hk/wiki/SendClientMessage
//-----------//
Not every interior/map is interior id 7, francis airport is 14. For more info on that visit
https://sampwiki.blast.hk/wiki/InteriorIDs
Step 1 - Making the command
So depending on what command processor you wanna use, (I use ZCMD) you wanna make your actual command.
Code:
CMD:8track(playerid, params[]) //This basically says to respond with these functions at the command /8track { // Here you want to place your functions (Coming up later on) return 1; //Tells the server the command was executed successfully }
Step 2 - Adding the teleport successful text
Now we will add a sendclientmessage function.
NOTE: You can #define SCM SendClientMessage , if you are lazy, but this will reduce your understanding of the process.
Code:
CMD:8track(playerid, params[]) //This basically says to respond with these functions at the command /8track { SendClientMessage(playerid, COLOR_GREEN, "You have successfully been teleported to (/8track)!"); //Tells the player that he was teleported to his specified location using his playerid return 1; //Tells the server the command was executed successfully }
Step 3 - Setting the players virtual world
WARNING!!!!: If you have other teleport commands, make sure to set the virtual worlds for them as 0 (if they are in the main world)
Code:
CMD:8track(playerid, params[]) //This basically says to respond with these functions at the command /8track { SendClientMessage(playerid, COLOR_GREEN, "You have successfully been teleported to (/8track)!"); //Tells the player that he was teleported to his specified location using his playerid SetPlayerInterior(playerid, 7); //This will set the virtual world/interior as the correct one for your teleport. In this case, 8track is interior id 7. return 1; //Tells the server the command was executed successfully }
Step 4 - Finalizing the command
lastly but surely we will finish up with the location.
Code:
CMD:8track(playerid, params[]) //This basically says to respond with these functions at the command /8track { SendClientMessage(playerid, COLOR_GREEN, "You have successfully been teleported to (/8track)!"); //Tells the player that he was teleported to his specified location using his playerid SetPlayerInterior(playerid, 7); //This will set the virtual world/interior as the correct one for your teleport. In this case, 8track is interior id 7. SetPlayerPos(playerid, -1354, -122, 1052); //This will teleport your player to the location specified, for this example, -1354, -122, 1052 is the XYZ Coordinates for the 8 figure track. return 1; //Tells the server the command was executed successfully }
Under public OnGameMode(or FilterScript)Init you would have your CreateStaticVehicle(Ex) with your vehicles in there, well, being created!
I hope this tutorial helped you!