Nicks please help me
#2

Your command using strcmp.
pawn Код:
if(strcmp(cmd, "/gotoid", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gotoid [Playerid/PartOfName]");
                return 1;
            }
            new Float:plocx,Float:plocy,Float:plocz;
            new plo;
            plo = ReturnUser(tmp);
            if (IsPlayerConnected(plo))
            {
                if(plo != INVALID_PLAYER_ID)
                {
                    if (PlayerInfo[playerid][pAdmin] >= 1) // Edit this line according to your admin variable
                    {
                        GetPlayerPos(plo, plocx, plocy, plocz);
                        SetPlayerInterior(playerid, GetPlayerInterior(plo));
                        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(plo));
                        if (GetPlayerState(playerid) == 2)
                        {
                            new tmpcar = GetPlayerVehicleID(playerid);
                            SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                            TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                        }
                        else
                        {
                            SetPlayerPos(playerid,plocx,plocy+2, plocz);
                        }
                        SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "You are not authorised to use that command.");
                    }
                }
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player.", plo);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
Your command using ZCMD with Sscanf.

pawn Код:
COMMAND:gotoid(playerid, params[])
    {
        if(IsPlayerConnected(playerid))
        {
            new plo;
            if(sscanf(params, "u",plo)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /goto [Playerid/PartOfName]");
            new Float:plocx,Float:plocy,Float:plocz;
            if (IsPlayerConnected(plo))
            {
                if(plo != INVALID_PLAYER_ID)
                {
                    if (PlayerInfo[playerid][pAdmin] >= 1) // Edit this line according to your admin variable
                    {
                        GetPlayerPos(plo, plocx, plocy, plocz);
                        SetPlayerInterior(playerid, GetPlayerInterior(plo));
                        SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(plo));
                        if (GetPlayerState(playerid) == 2)
                        {
                            new tmpcar = GetPlayerVehicleID(playerid);
                            SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                            TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                        }
                        else
                        {
                            SetPlayerPos(playerid,plocx,plocy+2, plocz);
                        }
                        SendClientMessage(playerid, COLOR_GRAD1, "   You have been teleported");
                    }
                    else return SendClientMessage(playerid, COLOR_GRAD1, "You are not authorised to use that command.");
                }
            }
            else return SendClientMessage(playerid, COLOR_GRAD1, "[CW:WW3] That is not an active player");
        }
        return 1;
    }
Reply


Messages In This Thread
Nicks please help me - by Nicks - 26.04.2012, 22:10
Re: Nicks please help me - by Ballu Miaa - 27.04.2012, 03:58
Re: Nicks please help me - by ReneG - 27.04.2012, 04:00
Re: Nicks please help me - by _Swift_ - 27.04.2012, 04:06
Re: Nicks please help me - by Ballu Miaa - 27.04.2012, 04:27
Re: Nicks please help me - by RollTi - 27.04.2012, 04:28
Re: Nicks please help me - by Ballu Miaa - 27.04.2012, 04:29

Forum Jump:


Users browsing this thread: 3 Guest(s)