GetPlayerMid
#1

PHP код:
stock GetPlayeridMid(name[]) //Boylett
{
    for (new 
0MAX_PLAYERSi++)
    {
        if (
IsPlayerConnected(i))
        {
            new 
gPlayerName[MAX_PLAYER_NAME];
            
GetPlayerName(igPlayerNameMAX_PLAYER_NAME);
            if(
strfind(gPlayerNamenametrue) != -1)
            {
                return 
i;
            }
       }
    }
    return 
INVALID_PLAYER_ID;

gives error undefined symbol GetPlayerMid, what gives?
PHP код:
    GetPlayerName(targetnamesizeof(name));
    new 
tname GetPlayerMid(name); 
Reply
#2

Change

new tname = GetPlayerMid(name);

to

new tname = GetPlayeridMid(name);
Reply
#3

Quote:
Originally Posted by NoteND
Посмотреть сообщение
Change

new tname = GetPlayerMid(name);

to

new tname = GetPlayeridMid(name);
omg I'm so stupid, thanks haha
Reply
#4

Quote:
Originally Posted by Kevinas100
Посмотреть сообщение
omg I'm so stupid, thanks haha
happens to the best
Reply
#5

Код:
stock GetPlayeridMid(name[]) //Boylett 
{ 
    for (new i = 0; i < MAX_PLAYERS; i++) 
    { 
        if (IsPlayerConnected(i)) 
        { 
            new gPlayerName[MAX_PLAYER_NAME]; 
            GetPlayerName(i, gPlayerName, MAX_PLAYER_NAME); 
            if(strfind(gPlayerName, name, true) != -1) 
            { 
                return i; 
            } 
       } 
    } 
    return INVALID_PLAYER_ID; 
}
What a horrible function you are using here!

You can't use this with any reliability heck there isn't even any sanity checks at all to validate your input data.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
What are you trying to do? This can return so many false positives, and I've not seen anyone trying to get an ID from a name like this since sscanf came out 10 years ago...
get half of a players name
Reply
#7

PHP код:
uidFromName(userName[]){
    new 
userID;
    
sscanf(userName,"u",userID)
    return 
userID;

Reply
#8

fixed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)