Posts: 176
Threads: 10
Joined: Oct 2010
Reputation:
0
well ok idk but how is this gonna work first how can i make it globally to 1, after that how can we make if the player types uchiha and the name is sasuke_uchiha it will work with making MATCH_NAME_PARTIAL but how to do that if there are 3 online player 1 me and other two Sasuke_uchiha and Itachi_Uchiha if i type uchiha it should say "Uchiha is found in multiple name please be more specific" and i am using specifiers "U".
Posts: 2,593
Threads: 34
Joined: Dec 2007
MATCH_NAME_PARTIAL:
pawn Код:
Currently sscanf will search for players by name, and will ALWAYS search for player whose name STARTS with the specified string. If you have, say "[CLAN]******" connected and someone types "******", sscanf will not find "[CLAN]******" because there name doesn't start with the specified name. This option, when set to 1, will search ANYWHERE in the player's name for the given string.
CELLMIN_ON_MATCHES:
pawn Код:
Whatever the value of "MATCH_NAME_PARTIAL", the first found player will always be returned, so if you do a search for "_" on an RP server, you could get almost anyone. To detect this case, if more than one player will match the specified string then sscanf will return an ID of "cellmin" instead. This can be combined with "U" for a lot more power:
pawn Код:
sscanf(params, "?<CELLMIN_ON_MATCHES=1>U(-1)", id);
if (id == -1)
{
// No player was entered.
}
else if (id == cellmin)
{
// Multiple matches found
}
else if (id == INVALID_PLAYER_ID)
{
// Entered player is not connected.
}
else
{
// Found just one player.
}
Posts: 2,593
Threads: 34
Joined: Dec 2007
pawn Код:
CMD:check(playerid, params[])
{
if(gLogged[playerid] == 0) SendLanguageMessage(playerid, COLOR_WHITE, LoginOnlyEN, LoginOnlyRO);
else if(PlayerInfo[playerid][pAdmin] < 1 && PlayerInfo[playerid][pHelper] < 1) SendLanguageMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: You are not admin or a helper.", "{FFFFCC}Eroare: Nu esti admin sau helper.");
else if(AccountLocked[playerid] == 0) SendLanguageMessage(playerid, COLOR_WHITE, "{FFB870}Error: Your account is locked. Type /unlockacc to unlock it and use this command.", "{FFB870}Eroare: Contul tau este blocat. Scrie /unlockacc pentru a il debloca si pentru a folosi aceasta comanda.");
else
{
new id;
sscanf(params, "?<CELLMIN_ON_MATCHES=1>U(-1)", id);
if(id == -1)
{
// No player was entered.
SendLanguageMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /check <Name/Playerid>","{B8DBFF}Sintaxa: /check <Nume/ID>");
}
else if(id == cellmin)
{
// Multiple matches found
// Uchiha is found in multiple name please be more specific
SendLanguageMessage(playerid, 0xFFFFFFFF, "{FFFFCC}Player is found in multiple name please be more specific.", "{FFFFCC}Prea multi jucatori corespund cautarii. Foloseste unul dintre aceste ID-uri.");
}
else if(id == INVALID_PLAYER_ID)
{
// Entered player is not connected.
SendLanguageMessage(playerid, COLOR_WHITE, PlayerOfflineEN, PlayerOfflineRO);
}
else
{
// Found just one player.
ShowStats(playerid, id);
}
}
return 1;
}
?
Posts: 176
Threads: 10
Joined: Oct 2010
Reputation:
0
I want to use stock CheckMultipleNames, but this it does not work because cellmin is always equal with --.