29.03.2013, 21:49
I'm trying to show player's ID above their head, but something is terribly wrong. Nothing is appearing so I guess the problem is within those coordinates?
pawn Код:
public OnPlayerConnect(playerid)
{
new
string[32],
name[MAX_PLAYER_NAME],
Text3D:label = Create3DTextLabel(string, White, 30.0, 40.0, 50.0, 40.0, 0);
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "ID: %i", GetPlayerID(name));
Attach3DTextLabelToPlayer(label, playerid, 0.0, 0.0, 0.7);
return 1;
}
pawn Код:
stock GetPlayerID(const name[])
{
new pName[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GetPlayerName(i, pName, MAX_PLAYER_NAME);
if(!strcmp(pName, name))
return i;
}
return INVALID_PLAYER_ID;
}