13.02.2010, 15:01
Hey, I'm working on GetPlayerID and SetPlayerID functions.
I need all the help aviable to make it work.
Here is what I have done so far:
Evrything is untested. (At least no errors while compiling)
I need all the help aviable to make it work.
Here is what I have done so far:
Evrything is untested. (At least no errors while compiling)
pawn Код:
stock GetPlayerID(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetIDFromName(pName);
return pName;
}
pawn Код:
stock GetIDFromName(string[])
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) == 1)
{
new tName[MAX_PLAYER_NAME];
GetPlayerName(i, tName, sizeof(tName));
if(strcmp(tName, string, true, strlen(string)) == 0)
{
return i;
}
}
}
return INVALID_PLAYER_ID;
}