24.05.2014, 13:36
Does that mean every player who joins gets a new ID pressed against a constant prefix as their name?
Like -
Player_1
Player_2
Player_3
Is that it?
If you want to do that -
EDIT: I am really sorry, I realise there are better ways of doing this, but I am really tired and I'll edit this and post some better code when I can
Like -
Player_1
Player_2
Player_3
Is that it?
If you want to do that -
pawn Код:
#define CONST_PREFIX "Inconnu_"
ReturnUserBySuffix( suffix )
{
new name[MAX_PLAYER_NAME] = CONST_PREFIX,
suff[7];
valstr(suff, suffix);
strcat(name, suff);
new pName[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerName(i, pName, MAX_PLAYER_NAME);
if(!strcmp(pName, name)) return i;
}
return INVALID_PLAYER_ID;
}