need help with teleport command
#10

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Why do you reply with stupid shit instead of giving the real answer?

Use strcmp to compare the parameter after your command.
pawn Код:
COMMAND:fly(playerid, params[])
{
        new pname[MAX_PLAYER_NAME];
        new id;
        if(!strcmp(params, "playground", true)) // Checking if params is playground
        {
            SetPlayerPos(playerid, xpos, ypos, zpos); // Change them with your location's x y z
        }
        else if(!strcmp(params, "ls", true))
        {
            // Same stuff, if you want to add more, do what I did.
        }
        else if(sscanf(params,"u",id)) SendClientMessage(playerid, COLOR_ORANGE, "/fly <id> OR /fly <place>"); /*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;
}
I added to your usage message "OR /fly <place>" just so the player knows he can teleport to players and places.
yes! this worked! Thank you GC and Stinged! Eventually I may want to read my teleport location points through a file but this will do for now.

dirigent00, thanks for recommending that script....i couldn't get it to work somehow
Reply


Messages In This Thread
need help with teleport command - by Tommeh - 11.08.2014, 05:10
Re: need help with teleport command - by rockhopper - 11.08.2014, 05:26
Re: need help with teleport command - by Tommeh - 11.08.2014, 05:36
Re: need help with teleport command - by dirigent00 - 11.08.2014, 05:47
Re: need help with teleport command - by Tommeh - 11.08.2014, 07:06
Re: need help with teleport command - by GC - 11.08.2014, 08:46
Re: need help with teleport command - by Stinged - 11.08.2014, 08:50
Re: need help with teleport command - by dirigent00 - 11.08.2014, 09:41
Re: need help with teleport command - by Stinged - 11.08.2014, 09:52
Re: need help with teleport command - by Tommeh - 11.08.2014, 10:20

Forum Jump:


Users browsing this thread: 4 Guest(s)