[Tutorial] Creating a Teleport (Supports with Angle)
#1

Creating a Teleport (Supports with Angle)
Brought you by Mr.SmileWinky!

Introduction:

Need a tutorial that teach you about teleport command that supports with angle? this is for you.
This is commonly use in RP/Stunt/DM

Step by Step:

I'm gonna use ZCMD you can also use strcmp for this tutorial.
ZCMD can be download at Filterscript & Include Section.

ok i'm gonna put the command on the bottom of my script.
heres the full command

pawn Code:
CMD:lsair(playerid, params[])
{
     new string[128],pname[MAX_PLAYER_NAME]; //string 128 is the max string value/pname will be part of the code later.
     GetPlayerName(playerid, pname, sizeof(pname)); //pname was define.
     format(string, sizeof(string), "%s has teleport to Los Santos Airport (/lsair)", pname); //%s will be the name of player. Pname is used here as %s
     SendClientMessageToAll(COLOR_TELEPORT, string); //string (format) is used here, the message will sent to all
     if(IsPlayerInAnyVehicle(playerid)) //checks if player is riding on any vehicle
     {
           /* if player is in any vehicle the SetVehiclePos and SetVehicleZAngle will be called */
           SetVehiclePos(GetPlayerVehicleID(playerid), 1910.9939,-2393.6472,13.1090); //Player's Vehicle Position will be set at coordinate 1910.9939,-2393.6472,13.1090
       SetVehicleZAngle(GetPlayerVehicleID(playerid), 188.5087); //Player's Vehicle Position will be face at angle coordinate 188.5087
     }
     else //checks if player is not riding on vehicle
     {
           /* SetPlayerPos and SetPlayerFacingAngle will be called */
       SetPlayerPos(playerid, 1883.2531,-2401.4688,13.5547); //Player's Position will be set at coordinate 1883.2531,-2401.4688,13.5547
       SetPlayerFacingAngle(playerid, 204.4409); //Player's Position will be face at angle coordinate 204.4409
     }
     return 1; //without this the server will read it as "SERVER: Unknown Command"
}
Sorry for my bad english .

I hope i helped you

once again Brought you by Mr.SmileWinky!
Reply
#2

Good tutorial! 5/5. I learned that without return 1; in Game-Modes it will return SERVER: Unknown Command. .
Reply
#3

not many people will need this.
as there's lots of tut like that and lots of people that learn scripting from other people scripts (like the guy above).
anyway,if you already created a tut like that,so at least explane some more ways to make a teleport & easier ways,like using a "stock".
so they could just use:
pawn Code:
TeleportPlayerToLS(playerid);
or something like that....

btw nice tut ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)