09.11.2017, 20:53
Hello, I have a problem with my script for viewing HP, Names in the 3DLabel is just a problem that if I join, I often blinks the label just above one player.
Above one player, 10 names are displayed within a few seconds.
This code:
This use only Disconnect and Connect
Timer
Update status
This has never happened to me as displaying the text just above one player, meaning that there will be ten names.
Above one player, 10 names are displayed within a few seconds.
This code:
Код:
new Text3D:playerstatuslabel[MAX_PLAYERS];
Код:
Delete3DTextLabel(playerstatuslabel[playerid]); KillTimer(playertm[playerid]);
Код:
stock StartPlayerStatus(playerid) // this use only login and register { playerstatuslabel[playerid] = Create3DTextLabel("[ Loading ]", 0x008080FF, 30.0, 40.0, 50.0,5.0, 0); Attach3DTextLabelToPlayer(playerstatuslabel[playerid], playerid, 0.0, 0.0, 0.5); playertm[playerid] = SetTimerEx("PlayerLabel",700, true, "i", playerid); return 1; }
Код:
forward PlayerLabel(playerid); public PlayerLabel(playerid) { UpdatePlayerStatus(playerid); return 1; }
Код:
stock UpdatePlayerStatus(playerid) { new str[200],lbl[100]; format(lbl,sizeof(lbl),"[ %s ]\n",GetName(playerid)); strcat(str,lbl); if(PlayerInfo[playerid][pVesta] > 0) { format(lbl,sizeof(lbl)," HP:%d || AR:%d\n\n",floatround(PlayerInfo[playerid][pHP]),floatround(PlayerInfo[playerid][pVesta])); strcat(str,lbl); } else if(PlayerInfo[playerid][pVesta] <= 0) { format(lbl,sizeof(lbl)," HP:%d\n\n",floatround(PlayerInfo[playerid][pHP])); strcat(str,lbl); } if(deathmode[playerid] == 1) { format(lbl,sizeof(lbl),"[ DEATHMODE ]"); strcat(str,lbl); } else if(deathmode[playerid] == 0) { format(lbl,sizeof(lbl),""); strcat(str,lbl); } Update3DTextLabelText(playerstatuslabel[playerid],0xFFFFFFFF,str); return 1; }