08.04.2017, 00:52
PHP код:
new Text3D:LevelPlayer[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("UpdateLabel", 20000, true);
return 1;
}
public OnPlayerSpawn(playerid)
{
new str[256];
if(!IsPlayerNPC(playerid)) {
format(str,sizeof(str),"Level: %d", Player[playerid][pLevel]);
LevelPlayer[playerid] = Create3DTextLabel(str, -1, 30.0, 40.0, 50.0, 40.0, 0);
Attach3DTextLabelToPlayer(LevelPlayer[playerid], playerid ,0.0, 0.0, 0.7);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
Delete3DTextLabel(LevelPlayer[playerid]);
return 1;
}
stock UpdateLabel() {
new str[256];
for(new i = 0; i < MAX_PLAYERS; ++i) {
if(!IsPlayerNPC(i)) {
format(str,sizeof(str),"Level: %d",Player[i][pLevel]);
Update3DTextLabelText(LevelPlayer[i], COR_BRANCO,str);
}
}
}