[Duv]Return
#1

Bom eu fui pegar um cmd do GF.. e deu um problema no ReturnUser alguem sabe como tirar?
Code:
C:\Users\john\Desktop\samp\Filterscripts\testex.pwn(204) : error 017: undefined symbol "ReturnUser"
C:\Users\john\Desktop\samp\Filterscripts\testex.pwn(283) : error 017: undefined symbol "ReturnUser"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Erro
Code:
giveplayerid = ReturnUser(tmp);
giveplayerid = ReturnUser(tmp);
e as linhas que tгo com o ReturnUser...
Editado===

Problema resolvido
Code:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
new pos = 0;
while (text[pos] < 0x21) // Strip out leading spaces
{
if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
pos++;
}
new userid = INVALID_PLAYER_ID;
if (IsNumeric(text[pos])) // Check whole passed string
{
// If they have a numeric name you have a problem (although names are checked on id failure)
userid = strval(text[pos]);
if (userid >=0 && userid < MAX_PLAYERS)
{
if(!IsPlayerConnected(userid))
{
/*if (playerid != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, 0xFF0000AA, "User not connected");
}*/
userid = INVALID_PLAYER_ID;
}
else
{
return userid; // A player was found
}
}
/*else
{
if (playerid != INVALID_PLAYER_ID)
{
SendClientMessage(playerid, 0xFF0000AA, "Invalid user ID");
}
userid = INVALID_PLAYER_ID;
}
return userid;*/
// Removed for fallthrough code
}
// They entered [part of] a name or the id search failed (check names just incase)
new len = strlen(text[pos]);
new count = 0;
new name[MAX_PLAYER_NAME];
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, name, sizeof (name));
if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
{
if (len == strlen(name)) // Exact match
{
return i; // Return the exact player on an exact match
// Otherwise if there are two players:
// Me and MeYou any time you entered Me it would find both
// And never be able to return just Me's id
}
else // Partial match
{
count++;
userid = i;
}
}
}
}
if (count != 1)
{
if (playerid != INVALID_PLAYER_ID)
{
if (count)
{
SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
}
}
userid = INVALID_PLAYER_ID;
}
return userid; // INVALID_USER_ID for bad return
}
Reply
#2

Procura no GM sobre ReturnUser e copia tmb.
Reply
#3

olha minha assintura, tem la uma que diz:


USE O SEARCH
Reply
#4

Quote:
Originally Posted by Ambrуsio
Procura no GM sobre ReturnUser e copia tmb.
Eu copiei tudo e msm assim da erro
Reply
#5

Isso no final do gm:

pawn Code:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
    new pos = 0;
    while (text[pos] < 0x21)
    {
    if (text[pos] == 0) return INVALID_PLAYER_ID;
    pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos]))
    {
    userid = strval(text[pos]);
    if (userid >=0 && userid < MAX_PLAYERS)
    {
    if(!IsPlayerConnected(userid))
    {
    userid = INVALID_PLAYER_ID;
    }
    else
    {
    return userid;
    }
    }
    }
    new len = strlen(text[pos]);
    new count = 0;
    new pname[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
    if (IsPlayerConnected(i))
    {
    GetPlayerName(i, pname, sizeof (pname));
    if (strcmp(pname, text[pos], true, len) == 0)
    {
    if (len == strlen(pname))
    {
    return i;
    }
    else
    {
    count++;
    userid = i;
    }
    }
    }
    }
    if (count != 1)
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    if (count)
    {
    SendClientMessage(playerid, COR_CINZA, "Hб vбrios usuбrios mъltiplos, digite o nome inteiro.");
    }
    else
    {
    SendClientMessage(playerid, COR_CINZA, "Nome do jogador nгo encontrado.");
    }
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid;
}
Reply
#6

Quote:
Originally Posted by Guilherme_Canani
Isso no final do gm:

pawn Code:
ReturnUser(text[], playerid = INVALID_PLAYER_ID)
{
    new pos = 0;
    while (text[pos] < 0x21)
    {
    if (text[pos] == 0) return INVALID_PLAYER_ID;
    pos++;
    }
    new userid = INVALID_PLAYER_ID;
    if (IsNumeric(text[pos]))
    {
    userid = strval(text[pos]);
    if (userid >=0 && userid < MAX_PLAYERS)
    {
    if(!IsPlayerConnected(userid))
    {
    userid = INVALID_PLAYER_ID;
    }
    else
    {
    return userid;
    }
    }
    }
    new len = strlen(text[pos]);
    new count = 0;
    new pname[MAX_PLAYER_NAME];
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
    if (IsPlayerConnected(i))
    {
    GetPlayerName(i, pname, sizeof (pname));
    if (strcmp(pname, text[pos], true, len) == 0)
    {
    if (len == strlen(pname))
    {
    return i;
    }
    else
    {
    count++;
    userid = i;
    }
    }
    }
    }
    if (count != 1)
    {
    if (playerid != INVALID_PLAYER_ID)
    {
    if (count)
    {
    SendClientMessage(playerid, COR_CINZA, "Hб vбrios usuбrios mъltiplos, digite o nome inteiro.");
    }
    else
    {
    SendClientMessage(playerid, COR_CINZA, "Nome do jogador nгo encontrado.");
    }
    }
    userid = INVALID_PLAYER_ID;
    }
    return userid;
}
Ou adicione o include chamado "utils"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)