SA-MP Forums Archive
[SOLVED] How to get it to check to see if the player is trying to goto himself - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] How to get it to check to see if the player is trying to goto himself (/showthread.php?tid=121772)



[SOLVED] How to get it to check to see if the player is trying to goto himself - JoeDaDude - 18.01.2010

I want to get it,
So if im on my server and my id is 0, And i say /goto 0, It says i cant, Because im trying to goto myself,
So how do i make it, So it checks if im trying to goto myself and dosent let me with a message telling me?

heres the code im using so far:

pawn Код:
dcmd_goto(playerid, params[])
{
    if (strlen(params))
    {
        id = strval(params);
        if (IsPlayerConnected(id))
        {
          if(Administrator[playerid] >= 1)
            {
            new Float:x, Float:y, Float:z;
            GetPlayerPos(id, x, y, z);
            new name[MAX_PLAYER_NAME], string[48];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Administrator %s has teleported to your location.", name);
        SendClientMessage(id, COLOR_WHITE, string);
            SetPlayerPos(playerid, x, y, z);
           
        GetPlayerName(id, name, sizeof(name));
        format(string, sizeof(string), "You have teleported to %s location", name);
        SendClientMessage(playerid, COLOR_WHITE, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "You are not a Administrator");
            }
        }
        else
        {
          SendClientMessage(playerid, COLOR_RED, "Player not Found");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Usage: /goto [Playerid/PartOfName]");
    }
    return 1;
}



Re: How to get it to check to see if the player is trying to goto himself - dice7 - 18.01.2010

pawn Код:
if(id == playerid) // players wants to tele to himself



Re: How to get it to check to see if the player is trying to goto himself - JoeDaDude - 18.01.2010

Ty