05.03.2013, 03:06
I have this command called /fly which is exactly the same as i /goto. However whenever you teleport to the person, I want it to where you spawn from the sky with a parachute. How would i make that in my code?
Код:
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; //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);//Teleports the admin to the player's x,y, and z co-ordinates we set earlier } } } return 1; }