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;
}
GetPlayerName(target, name, sizeof(name));
new tname = GetPlayerMid(name);
|
Change
new tname = GetPlayerMid(name); to new tname = GetPlayeridMid(name); |
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 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...
|
uidFromName(userName[]){
new userID;
sscanf(userName,"u",userID)
return userID;
}