code optimization onplayerupdate
#1

I implemented the code in the arena when the killer and die show textdraw the number of times but is there a way for me not to put it in the onplayerupdate?
can anyone optimize it help me?
Код:
new PlayerText:Score_Arena[MAX_PLAYERS][3];
Код:
if(GetPVarInt(playerid, "IsInArena") >= 0)
	{
	    new scp[128];
	    format(scp, sizeof(scp), "Kill: %d~n~Death: %d", PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
	    PlayerTextDrawSetString(playerid, Score_Arena[playerid][2], scp);
	    for(new i = 0; i < 3; i++)
	    {
	        PlayerTextDrawShow(playerid, Score_Arena[playerid][i]);
	    }
	}
	else
	{
	    for(new i = 0; i < 3; i++)
	    {
	        PlayerTextDrawHide(playerid, Score_Arena[playerid][i]);
	    }
	}
Код:
Score_Arena[playerid][0] = CreatePlayerTextDraw(playerid, 25.000000, 187.083374, "LD_SPAC:white");
	PlayerTextDrawLetterSize(playerid, Score_Arena[playerid][0], 0.000000, 0.000000);
	PlayerTextDrawTextSize(playerid, Score_Arena[playerid][0], 92.000000, 57.000000);
	PlayerTextDrawAlignment(playerid, Score_Arena[playerid][0], 1);
	PlayerTextDrawColor(playerid, Score_Arena[playerid][0], 170);
	PlayerTextDrawSetShadow(playerid, Score_Arena[playerid][0], 0);
	PlayerTextDrawSetOutline(playerid, Score_Arena[playerid][0], 0);
	PlayerTextDrawBackgroundColor(playerid, Score_Arena[playerid][0], 255);
	PlayerTextDrawFont(playerid, Score_Arena[playerid][0], 4);
	PlayerTextDrawSetProportional(playerid, Score_Arena[playerid][0], 0);
	PlayerTextDrawSetShadow(playerid, Score_Arena[playerid][0], 0);

	Score_Arena[playerid][1] = CreatePlayerTextDraw(playerid, 33.500000, 170.166687, "Arena");
	PlayerTextDrawLetterSize(playerid, Score_Arena[playerid][1], 0.712000, 2.988333);
	PlayerTextDrawAlignment(playerid, Score_Arena[playerid][1], 1);
	PlayerTextDrawColor(playerid, Score_Arena[playerid][1], -1);
	PlayerTextDrawSetShadow(playerid, Score_Arena[playerid][1], 0);
	PlayerTextDrawSetOutline(playerid, Score_Arena[playerid][1], 1);
	PlayerTextDrawBackgroundColor(playerid, Score_Arena[playerid][1], 255);
	PlayerTextDrawFont(playerid, Score_Arena[playerid][1], 0);
	PlayerTextDrawSetProportional(playerid, Score_Arena[playerid][1], 1);
	PlayerTextDrawSetShadow(playerid, Score_Arena[playerid][1], 0);

	Score_Arena[playerid][2] = CreatePlayerTextDraw(playerid, 32.000000, 204.583343, "Kill: 5~n~Death: 0");
	PlayerTextDrawLetterSize(playerid, Score_Arena[playerid][2], 0.400000, 1.600000);
	PlayerTextDrawAlignment(playerid, Score_Arena[playerid][2], 1);
	PlayerTextDrawColor(playerid, Score_Arena[playerid][2], -1);
	PlayerTextDrawSetShadow(playerid, Score_Arena[playerid][2], 0);
	PlayerTextDrawSetOutline(playerid, Score_Arena[playerid][2], 0);
	PlayerTextDrawBackgroundColor(playerid, Score_Arena[playerid][2], 255);
	PlayerTextDrawFont(playerid, Score_Arena[playerid][2], 3);
	PlayerTextDrawSetProportional(playerid, Score_Arena[playerid][2], 1);
	PlayerTextDrawSetShadow(playerid, Score_Arena[playerid][2], 0);
Reply
#2

Yes, in `OnPlayerDeath` callback. This is when kills/deaths change and should updated. Show the textdraws once (when a new round starts) and then just update the textdraw string without any player-loop to re-show it.
Reply
#3

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
Yes, in `OnPlayerDeath` callback. This is when kills/deaths change and should updated. Show the textdraws once (when a new round starts) and then just update the textdraw string without any player-loop to re-show it.
I can not
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)