[AJUDA] /goto
#1

Alguйm pode adaptar esse cуdigo pra player ?
Thx .

pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
    {
        GetPlayerName(playerid, sendername, sizeof(sendername));
        PlayerInfo[playerid][pAdmin] = dini_Int(udb_encode(sendername), "level");
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_DBLUE, "Uso correto: /goto [id do player]");
            return 1;
        }
        new Float:plocx,Float:plocy,Float:plocz;
        giveplayerid = strval(tmp);
        if(logged[playerid] == 1)
        {
            if(PlayerInfo[playerid][pAdmin] >= 2)
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    format(string, sizeof(string), "Vocк se teleportou para %s(%i).", giveplayer, giveplayerid);
                    SendClientMessage(playerid, COLOR_BLUE, string);
                    GetPlayerPos(giveplayerid, plocx, plocy, plocz);
                    new intid = GetPlayerInterior(giveplayerid);
                    SetPlayerInterior(playerid,intid);
                    new PlayerName[30];
                    GetPlayerName(playerid, PlayerName, 30);
                    printf("[Command] %s usou /goto para se teleportar para %s.", PlayerName, giveplayer);
                    if (GetPlayerState(playerid) == 2)
                    {
                        new tmpcar = GetPlayerVehicleID(playerid);
                        SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                    }
                    else
                    {
                            SetPlayerPos(playerid,plocx,plocy+2, plocz);
                    }
                }
                else
                {
                    format(string, sizeof(string), "%d nгo й um player ativo!", giveplayerid);
                    SendClientMessage(playerid, COLOR_RED, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Vocк nгo permissгo para usar este comando!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Vocк tem que estar logado para usar este comando!");
        }
        return 1;
    }
Reply
#2

do meu game mode

pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
    {
        if(Admin[playerid] < 1) return SendClientMessage(playerid, VERDE_AZUL, "Erro: {FFA500} Vocк nгo estб autorizado a usar este comando.");
        if(AFK[playerid] == 1) return SendClientMessage(playerid, VERDE_AZUL, "Erro: {FFA500} Vocк estб AFK.");
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Uso: /goto [ID]");
        new id, Float:P[3], str[128], n[24], n2[24];
        id = ReturnUser(tmp);
        if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "ID INVALIDO");
        GetPlayerName(id, n, sizeof(n));
        GetPlayerName(playerid, n2, 24);
        GetPlayerPos(id, P[0], P[1], P[2]);
        SetPlayerPos(playerid, P[0]+1, P[1], P[2]+0.5);
        SetPlayerInterior(playerid, GetPlayerInterior(id));
        format(str, sizeof(str), "Vocк foi atй o jogador {FF00FF}%s{FFFFFF} .", n);
        SendClientMessage(playerid, -1, str);
        format(str, sizeof(str), "O admin {FF00FF} %s{FFFFFF} veio atй vocк.", n2);
        SendClientMessage(id, -1, str);
        return 1;
    }
@cуdigo quem fez pro meu gm foi o Shadow
Reply
#3

Isto deve resolver o seu problema :


Adaptei pra vocк :


pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_DBLUE, "Uso correto: /goto [id do player]");
            return 1;
        }
        new Float:plocx,Float:plocy,Float:plocz;
        giveplayerid = strval(tmp);
        if(logged[playerid] == 1)
        {
            if(IsPlayerConnected(giveplayerid))
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                new PlayerName[30];
                GetPlayerName(playerid, PlayerName, 30);
                format(string, sizeof(string), "Vocк se teleportou para %s(%i).", giveplayer, giveplayerid);
                SendClientMessage(playerid, COLOR_BLUE, string);
                GetPlayerPos(giveplayerid, plocx, plocy, plocz);
                new intid = GetPlayerInterior(giveplayerid);
                SetPlayerInterior(playerid,intid);
                printf("[Command] %s usou /goto para se teleportar para %s.", PlayerName, giveplayer);
                if (GetPlayerState(playerid) == 2)
                {
                    new tmpcar = GetPlayerVehicleID(playerid);
                    SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                }
                else
                {
                    SetPlayerPos(playerid,plocx,plocy+2, plocz);
                }
            }
            else
            {
                format(string, sizeof(string), "%d nгo й um player ativo!", giveplayerid);
                SendClientMessage(playerid, COLOR_RED, string);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Vocк tem que estar logado para usar este comando!");
        }
        return 1;
    }


Espero ter ajudado .
Reply
#4

Quote:
Originally Posted by rjjj
Посмотреть сообщение
Isto deve resolver o seu problema :


Adaptei pra vocк :


pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_DBLUE, "Uso correto: /goto [id do player]");
            return 1;
        }
        new Float:plocx,Float:plocy,Float:plocz;
        giveplayerid = strval(tmp);
        if(logged[playerid] == 1)
        {
            if(IsPlayerConnected(giveplayerid))
            {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                new PlayerName[30];
                GetPlayerName(playerid, PlayerName, 30);
                format(string, sizeof(string), "Vocк se teleportou para %s(%i).", giveplayer, giveplayerid);
                SendClientMessage(playerid, COLOR_BLUE, string);
                GetPlayerPos(giveplayerid, plocx, plocy, plocz);
                new intid = GetPlayerInterior(giveplayerid);
                SetPlayerInterior(playerid,intid);
                printf("[Command] %s usou /goto para se teleportar para %s.", PlayerName, giveplayer);
                if (GetPlayerState(playerid) == 2)
                {
                    new tmpcar = GetPlayerVehicleID(playerid);
                    SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                }
                else
                {
                    SetPlayerPos(playerid,plocx,plocy+2, plocz);
                }
            }
            else
            {
                format(string, sizeof(string), "%d nгo й um player ativo!", giveplayerid);
                SendClientMessage(playerid, COLOR_RED, string);
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Vocк tem que estar logado para usar este comando!");
        }
        return 1;
    }


Espero ter ajudado .
Deu esse erro vei:
pawn Код:
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4469) : error 017: undefined symbol "logged"
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4469) : warning 215: expression has no effect
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4469) : error 001: expected token: ";", but found "]"
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4469) : error 029: invalid expression, assumed zero
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4469) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
linha:

Код:
 if(logged[playerid] == 1)
Daн tirei o cуdigo do erro e deu esse:

pawn Код:
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4475) : error 017: undefined symbol "string"
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4475) : error 017: undefined symbol "string"
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4475) : error 029: invalid expression, assumed zero
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4475) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
linha:
Код:
format(string, sizeof(string), "Vocк se teleportou para %s(%i).", giveplayer, giveplayerid);
Ajuda
Reply
#5

pawn Код:
C:\Users\Jefferson Gomes\Desktop\SAMP 0.3a Server [De]\gamemodes\De.pwn(4475) : error 017: undefined symbol "string"
isso nгo й aquilo da string ja esta definida?
Reply
#6

Seu pedido deu a entender que vocк somente queria retirar o bloqueio de usuбrios nгo-administradores do comando .


Quote:
Originally Posted by .CrazZy._.[De]
Посмотреть сообщение
Alguйm pode adaptar esse cуdigo pra player ?
Thx .

Bem, reformei o comando :


pawn Код:
if(strcmp(cmd, "/goto", true) == 0)
    {
        #if !defined COLOR_DBLUE
        #define COLOR_DBLUE 0x7777DDFF
        #endif
        #if !defined COLOR_BLUE
        #define COLOR_BLUE 0x33CCFFAA
        #endif
        #if !defined COLOR_RED
        #define COLOR_RED 0xAA3333AA
        #endif
        new string[60];
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_DBLUE, "Uso correto: /goto [id do player]");
            return 1;
        }
        new Float:plocx,Float:plocy,Float:plocz;
        giveplayerid = strval(tmp);
        if(IsPlayerConnected(giveplayerid))
        {
            new PlayerName[30], GivePlayerName[30];
            GetPlayerName(playerid, PlayerName, 30);
            GetPlayerName(giveplayerid, GivePlayerName, 30);
            format(string, sizeof(string), "Vocк se teleportou para %s(%i).", GivePlayerName, giveplayerid);
            SendClientMessage(playerid, COLOR_BLUE, string);
            GetPlayerPos(giveplayerid, plocx, plocy, plocz);
            new intid = GetPlayerInterior(giveplayerid);
            SetPlayerInterior(playerid,intid);
            printf("[Command] %s usou /goto para se teleportar para %s.", PlayerName, GivePlayerName);
            if (GetPlayerState(playerid) == 2)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
            }
            else
            {
                SetPlayerPos(playerid,plocx,plocy+2, plocz);
            }
        }
        else
        {
            format(string, sizeof(string), "%d nгo й um player ativo!", giveplayerid);
            SendClientMessage(playerid, COLOR_RED, string);
        }
        return 1;
    }


Espero ter ajudado .
Reply
#7

rjjj, deu certo velho valeu mesmo, + reputation pra vocк !

@edit

pow, tб dando um erro... quando eu entro no jogo, uso o /goto, aparece que fui se teleportado pra mim mesmo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)