SA-MP Forums Archive
some admin command - 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: some admin command (/showthread.php?tid=92230)



some admin command - sandisk125 - 19.08.2009

can someone give me a code which makes an admin command; /coor <your coordinates>
i mean this command does for example: you type /coor 218.35,345.32,32.53.
i want this command to teleport you to any coordinates you want.
it is possible?


Re: some admin command - coole210 - 19.08.2009

pawn Код:
if(strcmp(cmd,"/coor",true) == 0) if(IsPlayerAdmin(playerid))
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /coor [coordX] [coordY] [coordZ]");
    new moneys = strval(tmp);
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /coor [coordX] [coordY] [coordZ]");
    new moneys2 = strval(tmp);
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /coor [coordX] [coordY] [coordZ]");
    new moneys3 = strval(tmp);
    SetPlayerPos(playerid,moneys,moneys2,moneys3);
    return 1;
}



Re: some admin command - sandisk125 - 19.08.2009

Quote:
Originally Posted by [TPG
Coole210 ]
pawn Код:
if(strcmp(cmd,"/coor",true) == 0) if(IsPlayerAdmin(playerid))
{
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /coor [coordX] [coordY] [coordZ]");
    new moneys = strval(tmp);
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /coor [coordX] [coordY] [coordZ]");
    new moneys2 = strval(tmp);
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid,COLOR,"USAGE: /coor [coordX] [coordY] [coordZ]");
    new moneys3 = strval(tmp);
    SetPlayerPos(playerid,moneys,moneys2,moneys3);
    return 1;
}
i got this errors:
pawn Код:
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1014) : error 017: undefined symbol "cmd"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1016) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1016) : error 017: undefined symbol "idx"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1017) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1017) : error 017: undefined symbol "COLOR"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1018) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1019) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1019) : error 017: undefined symbol "idx"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1020) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1020) : error 017: undefined symbol "COLOR"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1021) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1022) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1022) : error 017: undefined symbol "idx"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1023) : error 017: undefined symbol "tmp"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1023) : error 017: undefined symbol "COLOR"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1024) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


16 Errors.



Re: some admin command - coole210 - 19.08.2009

Add this right under OnPlayerCommandText out of all cmds

pawn Код:
new cmd[128], tmp[128], idx;
    cmd = strtok(cmdtext, idx);
EDIT: change COLOR to a defined color you have.


Re: some admin command - sandisk125 - 19.08.2009

Quote:
Originally Posted by [TPG
Coole210 ]
Add this right under OnPlayerCommandText out of all cmds

pawn Код:
new cmd[128], tmp[128], idx;
    cmd = strtok(cmdtext, idx);
EDIT: change COLOR to a defined color you have.
where to put that code?


Re: some admin command - coole210 - 19.08.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], tmp[128], idx;
    cmd = strtok(cmdtext, idx);



Re: some admin command - sandisk125 - 19.08.2009

Quote:
Originally Posted by [TPG
Coole210 ]
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], tmp[128], idx;
    cmd = strtok(cmdtext, idx);
now i got those errors:
pawn Код:
D:\gta san andreas\pawno\include\dutils.inc(298) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\gta san andreas\pawno\include\dutils.inc(462) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\gta san andreas\pawno\include\Dini.inc(46) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\gta san andreas\pawno\include\Dini.inc(54) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(12) : error 010: invalid function or declaration
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(723) : warning 219: local variable "cmd" shadows a variable at a preceding level
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(723) : warning 219: local variable "tmp" shadows a variable at a preceding level
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(723) : warning 219: local variable "idx" shadows a variable at a preceding level
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(724) : error 047: array sizes do not match, or destination array is too small
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1010) : warning 213: tag mismatch
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1010) : warning 202: number of arguments does not match definition
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1020) : error 047: array sizes do not match, or destination array is too small
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1023) : error 047: array sizes do not match, or destination array is too small
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1026) : error 047: array sizes do not match, or destination array is too small
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1075) : warning 219: local variable "cmd" shadows a variable at a preceding level
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1160) : warning 203: symbol is never used: "cmd"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1160) : warning 203: symbol is never used: "idx"
D:\GTA San Andreas\gamemodes\DMV1.0.pwn(1160) : warning 203: symbol is never used: "tmp"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.



Re: some admin command - Calgon - 19.08.2009

pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
    {
        tmp = strtok(cmdtext,idx);
        if (!strlen(tmp))
      {
        SendClientMessage(playerid, COLOR_GREY, "SYNTAX - /goto [interior] [x] [y] [z]");
        return 1;
      }
        new int_id;
        int_id = strval(tmp);

        tmp = strtok(cmdtext,idx);
        if (!strlen(tmp))
      {
        SendClientMessage(playerid, COLOR_GREY, "SYNTAX - /goto [interior] [x] [y] [z]");
        return 1;
      }
        new Float:int_x;
        int_x = floatstr(tmp);

        tmp = strtok(cmdtext,idx);
        if (!strlen(tmp))
      {
        SendClientMessage(playerid, COLOR_GREY, "SYNTAX - /goto [interior] [x] [y] [z]");
        return 1;
      }
        new Float:int_y;
        int_y = floatstr(tmp);

        tmp = strtok(cmdtext,idx);
        if (!strlen(tmp))
      {
        SendClientMessage(playerid, COLOR_GREY, "SYNTAX - /goto [interior] [x] [y] [z]");
        return 1;
      }
        new Float:int_z;
        int_z = floatstr(tmp);

        SetPlayerPos(playerid, int_x, int_y, int_z);
        SetPlayerInterior(playerid, int_id);
        return 1;
    }
That should work.