11.08.2014, 05:10
Ok so i have this command /fly which teleports the player to another player
However, I want this exact same code to teleport a player to an ACTUAL teleport spot
So as a result, I want something like this
/fly playground
Here's the actual playground coordinates
Can someone help with this?
Код:
COMMAND:fly(playerid, params[]) { new pname[MAX_PLAYER_NAME]; new id; /*Creates the player's name to teleport to, and the admin that initiated the command, and the target ID to teleport to.*/ if(sscanf(params,"u",id)) SendClientMessage(playerid, COLOR_ORANGE, "/fly <id>"); /*Takes the ID you entered and makes it the "id" we defined. If no ID is entered the error message shows up*/ { if(playerid == id) return SendClientMessage(playerid, COLOR_RED, "You can't teleport to yourself..."); /*Checks if the player id entered is not yours and if it is it shows the error message*/ else { if(!IsPlayerConnected(id)) SendClientMessage(playerid, COLOR_WHITE, "Player is Not Online"); /*Checks if the ID entered is a player that is online in the server, otherwise sends the error message*/ else { new Float:x,Float:y,Float:z; SetPlayerPos(playerid,x,y,z+100); //Defines the x,y, and z co-ordinates of the target player GetPlayerPos(id,Float:x,Float:y,Float:z);//Sets what the x,y, and z means GetPlayerName(id,pname,sizeof(pname)); //Gets the name of the player that is to be teleported to SetPlayerPos(playerid,x,y,z+425);//Teleports the admin to the player's x,y, and z co-ordinates we set earlier GivePlayerWeapon(playerid, 46, 1); } } } return 1; }
So as a result, I want something like this
/fly playground
Here's the actual playground coordinates
Код:
SetPlayerPos(playerid,1915.9410,-1400.3301,13.5703)