Need help Rep+1
#1

The Problem is Textdraws making lag alot..
I'm using the Textdraws Under OnGameInt
And using a timer of 1 sec to update it..
the Textdraws working fine but it making lot of
Lag.. How i can Fix that?

Код:
forward StatsInfromation();
public StatsInfromation()
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
	if (IsPlayerConnected(i))
  	{
  	new str[128];

	TextDrawHideForPlayer(i,Rank[i]);
    format(str, sizeof(str), "~y~Rank : ~w~%s" , GetRankName(i));
    TextDrawSetString(Rank[i],str);
    TextDrawShowForPlayer(i,Rank[i]);

	TextDrawHideForPlayer(i,Stats[i]);
    format(str, sizeof(str), "~b~Score : ~w~%d" , GetPlayerScore(i));
    TextDrawSetString(Stats[i],str);
    TextDrawShowForPlayer(i,Stats[i]);

	TextDrawHideForPlayer(i,kills[i]);
    format(str, sizeof(str), "~g~Kills : ~w~%d" , pInfo[i][Kills]);
    TextDrawSetString(kills[i],str);
    TextDrawShowForPlayer(i,kills[i]);

	TextDrawHideForPlayer(i,pDeaths[i]);
    format(str, sizeof(str), "~r~Deaths : ~w~%d" , pInfo[i][Deaths]);
    TextDrawSetString(pDeaths[i],str);
    TextDrawShowForPlayer(i,pDeaths[i]);

   	TextDrawHideForPlayer(i,HEADSHOTS[i]);
    format(str, sizeof(str), "~b~Headshots : ~w~%d" , pInfo[i][Headshot]);
    TextDrawSetString(HEADSHOTS[i],str);
    TextDrawShowForPlayer(i,HEADSHOTS[i]);

    TextDrawHideForPlayer(i,KILLINGSTREAK[i]);
    format(str, sizeof(str), "~r~Streak : ~w~%d" , Streaks[i]);
    TextDrawSetString(KILLINGSTREAK[i],str);
    TextDrawShowForPlayer(i,KILLINGSTREAK[i]);

    TextDrawHideForPlayer(i,RATIO[i]);
    format(str, sizeof(str), "~y~Ratio : ~w~%.2f" ,Float:pInfo[i][Kills]/Float:pInfo[i][Deaths]);
    TextDrawSetString(RATIO[i],str);
    TextDrawShowForPlayer(i,RATIO[i]);
	  }
	}
	return 1;
}
Reply
#2

You should make player textdraws instead of global if you are changing data depending on your player.
Reply
#3

How i can Convert these Global Textdraws to Players Textdraws..
Reply
#4

https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
https://sampwiki.blast.hk/wiki/PlayerTextDrawShow
https://sampwiki.blast.hk/wiki/PlayerTextDrawHide
https://sampwiki.blast.hk/wiki/PlayerTextDrawSetString
Reply
#5

Thanks Rep+1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)