08.12.2014, 01:36
(
Последний раз редактировалось Aerotactics; 08.12.2014 в 03:25.
)
What I want: a display of player names using SetObjectMaterialText and some objects.
The issue: SetObjectMaterialText lags the whole server each time it's called in this timer, making the objects being changed flash textures and the server pause:
RESOLVED! See comments.
The issue: SetObjectMaterialText lags the whole server each time it's called in this timer, making the objects being changed flash textures and the server pause:
RESOLVED! See comments.
pawn Код:
public BoardsUpdate()
{
new Status[16];
if(GameJoin == true)
{
Status = "Joinable";
}
else
{
Status = "Not Joinable";
}
SetObjectMaterialText(board1[2],"Status:",0,OBJECT_MATERIAL_SIZE_256x128,"Arial Black",36,0,0xFF000000,0x00000000);
SetObjectMaterialText(board1[3],Status,0,OBJECT_MATERIAL_SIZE_256x128,"Arial Black",36,0,0xFF000000,0x00000000);
switch(BoardSet)
{
case 0:
{
SetObjectMaterialText(board1[0],"Players",0,OBJECT_MATERIAL_SIZE_256x128,"Arial Black",36,0,0xFF000000,0x00000000);
SetObjectMaterialText(board1[1],"Connected",0,OBJECT_MATERIAL_SIZE_256x128,"Arial Black",36,0,0xFF000000,0x00000000);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetObjectMaterialText(board[i],GetName(i),0,OBJECT_MATERIAL_SIZE_256x128,"Arial",24,1,0xFF000000,0x00000000);
}
else
{
SetObjectMaterialText(board[i],"===",0,OBJECT_MATERIAL_SIZE_256x128,"Arial",24,1,0xFF000000,0x00000000);
}
}
}
case 1:
{
SetObjectMaterialText(board1[0],"Players",0,OBJECT_MATERIAL_SIZE_256x128,"Arial Black",36,0,0xFF000000,0x00000000);
SetObjectMaterialText(board1[1],"In-Game",0,OBJECT_MATERIAL_SIZE_256x128,"Arial Black",36,0,0xFF000000,0x00000000);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(PlayerIsInLobby[i] == false)
{
new Float:health, color;
GetPlayerHealth(i, health);
if(100 >= health >= 75) color = 0xFF00AA00;
if(74 >= health >= 50) color = 0xFFAAAA00;
if(49 >= health >= 25) color = 0xFFFF9900;
if(24 >= health >= 1) color = 0xFFAA0000;
if(health == 0) color = 0xFFAAAAAA;
SetObjectMaterialText(board[i],GetName(i),0,OBJECT_MATERIAL_SIZE_256x128,"Arial",24,1,color,0x00000000);
}
else
{
SetObjectMaterialText(board[i],"===",0,OBJECT_MATERIAL_SIZE_256x128,"Arial",24,1,0xFF000000,0x00000000);
}
}
}
}
return 1;
}