How to make a /gotoxyz Command ?
#1

Hi again,

as the title shows, i want to know how to make a /gotoxyz command that takes who type it if he is admin >=4.
For who don't know what is the " /gotoxyz " cmd is for, it tp the admin who type it to a specific Coordination. ( x , y , z ).
I want it for these Player Admin Level and Helper Level.
pawn Код:
if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 4)
Thanks for your help
Reply
#2

It would look something like this
Код:
CMD:tppos(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new Float:tpx,Float:tpy,Float:tpz,str[150];
        if(sscanf(params, "fff",tpx, tpy, tpz))
        {
            SendClientMessage(playerid, -1, "{FF0000}Syntax - {808080}/tppos <x> <y> <z>");
            return 1;
        }

        SetPlayerPos(playerid, tpx, tpy, tpz+1);
        format(str,sizeof(str),"{FFFF00}[Info] {808080}You have teleported to the coordinates: {FFFFFF}%f %f %f",tpx,tpy,tpz);
        SendClientMessage(playerid, -1, str);
    }else{
        SendClientMessage(playerid, -1, "{FF0000}[Error] {808080}You must be an admin to use this command.");
    }
    return 1;
}
This is code that I made myself in my filterscript. Just edit it to fit your likings of admin level ect

-You need zCmd for this to work
Reply
#3

For Ycommand:
Quote:

YCMD:gotoco(playerid, params[], help)
{
if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 4){
new Float, Float:y, Float:z;
if(sscanf(params, "fff", x, y, z)) return SendClientMessage(playerid, -1, "USAGE: /gotoco (x/y/z)");
if(IsPlayerInAnyVehicle(playerid))
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
SetPlayerPos(playerid, x, y, z);
}
return 1;
}

For Zcommand:
Quote:

CMD:gotoco(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 4){
new Float, Float:y, Float:z;
if(sscanf(params, "fff", x, y, z)) return SendClientMessage(playerid, -1, "USAGE: /gotoco (x/y/z)");
if(IsPlayerInAnyVehicle(playerid))
SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
SetPlayerPos(playerid, x, y, z);
}
return 1;
}

EDIT: sorry about the smilies, btw it is "Float: x".
Reply
#4

Try this one:
pawn Код:
CMD:gotoxyz(playerid,params[]) {
    if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 4)
        new Float:x, Float:y, Float:z;
        new tmp[128], tmp2[128], tmp3[128];
        new string[128], Index; tmp = strtok(params,Index); tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
        if(isnull(tmp) || isnull(tmp2) || isnull(tmp3)) return SendClientMessage(playerid,red,"USAGE: /gotoxyz [X],[Y],[Z]");
        x = strval(tmp);        y = strval(tmp2);       z = strval(tmp3);
        if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        else SetPlayerPos(playerid,x,y,z);
        format(string,sizeof(string),"You have teleported to %f, %f, %f", x,y,z); return SendClientMessage(playerid,blue,string);
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Btw. Pawnify your command is for rcon admins!
Reply
#5

+REP To both of you ! Thank you guys
Reply
#6

Quote:
Originally Posted by EgyptForLife
Посмотреть сообщение
+REP To both of you ! Thank you guys
Anytime
Reply
#7

Guys , The cmds didn't work cause i am not using these includes, the includes i am using are :
pawn Код:
#include <a_samp>
#include <core>
#include <ChatColor>
#include <Dini>
#include <float>
#include <file>
#include <JunkBuster>
#include <morphinc>
#include <time>
#include <utils>
And example of my commands ( /gotols )
pawn Код:
if(strcmp(cmd, "/gotols", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] >= 2 || PlayerInfo[playerid][pHelper] >= 2)
            {
                if (GetPlayerState(playerid) == 2)
                {
                    new tmpcar = GetPlayerVehicleID(playerid);
                    SetVehiclePos(tmpcar, 1529.8082,-1678.8477,13.3828);
                    TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
                }
                else
                {
                    SetPlayerPos(playerid, 1529.8082,-1678.8477,13.3828);
                }
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "You have been teleported to Los Santos");
                SetPlayerInterior(playerid,0);
                PlayerInfo[playerid][pInt] = 0;
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "{D02F2F}AdmCmd: %s has been teleported to Los Santos", sendername);
                ABroadCast(COLOR_RED,string,1);
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use that command");
            }
        }
        return 1;
    }
I hope you make a cmd like that, And I will give +REP, Again!
Reply
#8

You want to TP player to cordinates or you want to TP the player in LS ?
Reply
#9

Quote:
Originally Posted by LeroyII
Посмотреть сообщение
Try this one:
pawn Код:
CMD:gotoxyz(playerid,params[]) {
    if (PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pHelper] >= 4)
        new Float:x, Float:y, Float:z;
        new tmp[128], tmp2[128], tmp3[128];
        new string[128], Index; tmp = strtok(params,Index); tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
        if(isnull(tmp) || isnull(tmp2) || isnull(tmp3)) return SendClientMessage(playerid,red,"USAGE: /gotoxyz [X],[Y],[Z]");
        x = strval(tmp);        y = strval(tmp2);       z = strval(tmp3);
        if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
        else SetPlayerPos(playerid,x,y,z);
        format(string,sizeof(string),"You have teleported to %f, %f, %f", x,y,z); return SendClientMessage(playerid,blue,string);
    } else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
Btw. Pawnify your command is for rcon admins!
Yeah I was giving an example, I also said edit to your likings for admin level.

Glad the problem was resolved!
Reply
#10

Ok, sorry!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)