SA-MP Forums Archive
[AJUDA] O que esta Errado ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [AJUDA] O que esta Errado ? (/showthread.php?tid=164262)



[AJUDA] O que esta Errado ? - Adriano499 - 30.07.2010

Код:
#include <a_samp>
#define spec_modo_player 1
#define spec_modo_veic 2

new
    idEspiado[MAX_PLAYERS],
    idEspiando[MAX_PLAYERS],
    spec_modo[MAX_PLAYERS],
    bool:EstaEspiando[MAX_PLAYERS],
    gLIMITE_JOGADORES = -1;

forward GetPlayerID(string[]);

public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(espiar,6,cmdtext); ///////////////////linha16///////////////////
    return false; ///////////////////////linha17///////////
}

public OnPlayerConnect(playerid)
{
    idEspiando[playerid] = INVALID_PLAYER_ID;
    idEspiado[playerid] = INVALID_PLAYER_ID;
    return true;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
        if(GetPlayerState(i) == PLAYER_STATE_SPECTATING && idEspiado[i] == playerid)
        {
           TogglePlayerSpectating(i, 1);
           PlayerSpectateVehicle(i, vehicleid);
           spec_modo[playerid] = spec_modo_veic;
        }
  }
  return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerState(i) == PLAYER_STATE_SPECTATING && idEspiado[i] == playerid)
      {
        TogglePlayerSpectating(i, 1);
        PlayerSpectatePlayer(i, playerid);
      spec_modo[playerid] = spec_modo_player; ////////////////////////////linha 49 /////////////////
        }
    }
    return 1;
}


dcmd_espiar(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new
          plid,
            string[128];

        if(!strlen(params)) return SendClientMessage(playerid, 0xFFFFFFAA, "Digite: /espiar [id (ou nick) do jogador/off]");
        if(!psf_StrNumerica(params))
        {
        if(psf_ParteExiste(params, "off"))
          {
                if(idEspiando[playerid] != INVALID_PLAYER_ID)
                {
                    TogglePlayerSpectating(playerid, 0);
                    idEspiado[playerid] = INVALID_PLAYER_ID;
                    idEspiando[plid] = INVALID_PLAYER_ID;
                    spec_modo[playerid] = 0;
                    EstaEspiando[playerid] = false;
                    return 1;
                } else SendClientMessage(playerid, 0xFF0000AA, "Vocк nгo estб espiando ninguйm!");
                return 1;
          }
            else
            if(!psf_StrNumerica(params) && IsPlayerConnected(GetPlayerID(params)))
            {
              plid = GetPlayerID(params);
              EspiarPlayer(playerid, plid);
                format(string, sizeof(string), "Vocк estб espiando %s(id:%d).", PlayerName(plid), plid);
          SendClientMessage(playerid, 0x006600AA, string);
            } else SendClientMessage(playerid, 0xFF0000AA, "O playerid indicado nгo estб conectado.");
        }

        if(psf_StrNumerica(params))
        {
            plid = strval(params);
            if(IsPlayerConnected(plid))
            {
                EspiarPlayer(playerid, plid);
                format(string, sizeof(string), "Vocк estб espiando %s(id:%d).", PlayerName(plid), plid);
                SendClientMessage(playerid, 0x006600AA, string);
                return 1;
            } else SendClientMessage(playerid, 0xFF0000AA, "O playerid indicado nгo estб conectado.");
        }
    }
    return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
    new x = 0;
    while(x != MAX_PLAYERS)
    {
      if(IsPlayerConnected(x) &&    GetPlayerState(x) == PLAYER_STATE_SPECTATING && idEspiado[x] == playerid &&
        spec_modo[x] == spec_modo_player) SetPlayerInterior(x, newinteriorid);
        x++; /////////////////////////////linha112//////////////////////////
    }
}

public GetPlayerID(string[])
{
    for(new i = 0; i <= MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) == 1)
        {
            new testname[MAX_PLAYER_NAME];
            GetPlayerName(i, testname, sizeof(testname));
            //printf("GetP:testname = %s : string = %s",testname,string);
            if(psf_ParteExiste(string, testname))                                 ////////////////////linha 125///////////
            {
                //printf("TRUE GetP:testname = %s : string = %s playerid %d",testname,string, i);
                return i;
            }
        }
    }
    return INVALID_PLAYER_ID;
}

stock LerLimiteJogadores()
{
    if(gLIMITE_JOGADORES == -1) gLIMITE_JOGADORES = GetServerVarAsInt("maxplayers");
    return gLIMITE_JOGADORES;
}

stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    return name;
}

stock ProcurarJogadorID(playerid, str[], bool:leituratodos = true)
{
    new resultado;
    if(strlen(str))
    {
    if(psf_ParteExiste(str, "*"))
        {
            if(leituratodos) return -1;
            else
            {
                SendClientMessage(playerid, 0xFF0000AA, "Este comando nгo possui a funзгo 'todos' (*). Por favor, mencione um nome ou id.");
                return INVALID_PLAYER_ID+2;
            }
        }
        else if(!strcmp(str, "eu", true)) return playerid;
        LerLimiteJogadores();
        new nomef[MAX_PLAYER_NAME];
        psf_CopiarStr(nomef, str);
        resultado = ProcurarJogadorID_(nomef);
        if(resultado == INVALID_PLAYER_ID)
        {
          new strm[128];
            format(strm, sizeof(strm), "Referкncia '%s' nгo encontrada (jogador desconectado ou nome incompleto)!", str);
            SendClientMessage(playerid, 0xFF0000AA, strm);
        }
        return resultado;
    }
    SendClientMessage(playerid, 0xFF0000AA, "ERRO (PJID01): VALORES NULOS!");
    return INVALID_PLAYER_ID+1;
}

stock ProcurarJogadorID_(nomef[MAX_PLAYER_NAME])
{
  new
        t = strlen(nomef),
        tlj = strlen(psf_IntStr(gLIMITE_JOGADORES));
    if(psf_StrNumerica(nomef) && t <= tlj)
    {
      new valor = strval(nomef);
        if(t == 1 || t == 2) if(valor >= 0 && valor <= gLIMITE_JOGADORES) return valor;
        if(tlj > 2 && t == tlj) for(new i; i < gLIMITE_JOGADORES; i++) if(valor == i && IsPlayerConnected(i)) return i;
    }

    if(t > 2) for(new i; i < gLIMITE_JOGADORES; i++) if(!strcmp(PlayerName(i), nomef, true) && IsPlayerConnected(i)) return i;
    return INVALID_PLAYER_ID;
}

stock EspiarPlayer(playerid, espiadoid)
{
    TogglePlayerSpectating(playerid, 1);
    idEspiado[playerid] = espiadoid;
    idEspiando[espiadoid] = playerid;
    SetPlayerInterior(playerid,GetPlayerInterior(espiadoid));
    SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(espiadoid));
    if(IsPlayerInAnyVehicle(espiadoid))
    { ///////////////////////////linha203/////////////////////////////////////
        PlayerSpectateVehicle(playerid, GetPlayerVehicleID(espiadoid));
        idEspiado[playerid] = espiadoid;
        idEspiando[espiadoid] = playerid;
        spec_modo[playerid] = spec_modo_veic;
    }
    else
    {
        PlayerSpectatePlayer(playerid, espiadoid);
        idEspiado[playerid] = espiadoid;
        idEspiando[espiadoid] = playerid;
        spec_modo[playerid] = spec_modo_player;
    }
    return 1;
}
? o que esta errado ? Obs: baixei em um blog.

Код:
C:\Documents and Settings\Adriano1\Meus documentos\weerw.pwn(16) : error 017: undefined symbol "dcmd"
C:\Documents and Settings\Adriano1\Meus documentos\weerw.pwn(17) : warning 217: loose indentation
C:\Documents and Settings\Adriano1\Meus documentos\weerw.pwn(49) : warning 217: loose indentation
C:\Documents and Settings\Adriano1\Meus documentos\weerw.pwn(112) : warning 217: loose indentation
C:\Documents and Settings\Adriano1\Meus documentos\weerw.pwn(125) : error 017: undefined symbol "psf_ParteExiste"
C:\Documents and Settings\Adriano1\Meus documentos\weerw.pwn(219) : warning 203: symbol is never used: "dcmd_espiar"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: [AJUDA] O que esta Errado ? - [NWD]Tweener_ - 30.07.2010

Que erro dб? Ou o que acontece?


Re: [AJUDA] O que esta Errado ? - Adriano499 - 31.07.2010

ajuda aki gente e urgente.