Problem With Admin Script DCMD.
#1

Hi Guys, i have a problem with goto code.
Код:
dcmd_goto(playerid,params[])
{
    new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
    new tmp[256], Index, str[49];
    tmp = strtok(params,Index), id = strval(tmp);
    GetPlayerName(id,on,sizeof(on));
    GetPlayerName(playerid,n,sizeof(n));
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
    if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /goto <ID> ");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
    format(str,sizeof(str),"Admin %s has teleported to %s",n,on);
    SendClientMessageToAll(ORANGE,str);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(id, x, y, z);
    SetPlayerPos(playerid, x+1, y+1, z);
    return 1;
}
Any errors or Warnings, but don't Work. What's wrong in this code? Thank's ^^

P.S: I added dcmd(goto,4,cmdtext); in OnPlayerCommandText.
Reply
#2

pawn Код:
dcmd_goto(playerid,params[])
{
    new id, n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
    new tmp[256], Index, str[49];
    tmp = strtok(params,Index), id = strval(tmp);
    GetPlayerName(id,on,sizeof(on));
    GetPlayerName(playerid,n,sizeof(n));
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");
    if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /goto <ID> ");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
    format(str,sizeof(str),"Admin %s has teleported to %s",n,on);
    SendClientMessageToAll(ORANGE,str);
    new Float:x, Float:y, Float:z;
    GetPlayerPos(id, x, y, z);
    SetPlayerPos(id, x+1, y+1, z);
    return 1;
}
You was tele'ing yourself to your own location, not to the other player.
Reply
#3

Thanks! Is Working now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)