[Ajuda] GetPlayerID dando erro
#1

PHP код:
new id GetPlayerID(InfoOrg[org][Lider]); 
Erro:
Код HTML:
C:\Users\LucaS\Desktop\GM TDM\gamemodes\Untitled.pwn(459) : error 017: undefined symbol "GetPlayerID"
Reply
#2

Adicione no seu script:

pawn Код:
stock GetPlayerID(const playername[], partofname=0) //By Jan "DracoBlue" Schьtze (edited by Gabriel "Larcius" Cordes)
{
    new i;
    new playername1[MAX_STRING];
    for (i=0;i<MAX_PLAYERS;i++)
    {
        if (IsPlayerConnected(i))
        {
            GetPlayerName(i,playername1,sizeof(playername1));
            if (strcmp(playername1,playername,true)==0)
            {
                return i;
            }
        }
    }
    new correctsigns_userid=-1;
    new tmpuname[MAX_STRING];
    new hasmultiple=-1;
    if(partofname)
    {
        for (i=0;i<MAX_PLAYERS;i++)
        {
            if (IsPlayerConnected(i))
            {
                GetPlayerName(i,tmpuname,sizeof(tmpuname));
                if (strfind(tmpuname,partofname,true)==0)
                {
                    hasmultiple++;
                    correctsigns_userid=i;
                }
                if (hasmultiple>0)
                {
                    return -2;
                }
            }
        }
    }
    return correctsigns_userid;
}
Retirado de Useful_Functions
Reply
#3

Tudo isso pra conseguir o ID de um Player deslogado?
Quote:

C:\Users\LucaS\Desktop\GM TDM\gamemodes\Untitled.pwn(459) : warning 204: symbol is assigned a value that is never used: "id"
C:\Users\LucaS\Desktop\GM TDM\gamemodes\Untitled.pwn(823) : error 017: undefined symbol "MAX_STRING"
C:\Users\LucaS\Desktop\GM TDM\gamemodes\Untitled.pwn(823) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\LucaS\Desktop\GM TDM\gamemodes\Untitled.pwn(823) : error 036: empty statement
C:\Users\LucaS\Desktop\GM TDM\gamemodes\Untitled.pwn(823) : fatal error 107: too many error messages on one line

Reply
#4

Nгo sei estб certo, fiz o cуdigo por aqui mesmo.
pawn Код:
stock GetPlayerID(const parte_nome[]) {
    for(new i; i <= GetMaxPlayers(); i++) {
        if(!IsPlayerConnected(i)) continue;
        new ni[MAX_PLAYER_NAME];
        GetPlayerName(i, ni, sizeof(ni));
        if(strfind(ni, parte_nome, false) > -1)
            return i;
    }
    return INVALID_PLAYER_ID;
}
Testa ai, tenta ver se funciona.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)