Textdraw not working properly
#1

So I am using my own ranking system that display the current rank and the exp points using a textdraw.

The problem is when 2 or more players connected, the textdraw string is messed with other people rank & experience points. It keeps updating. Please help me as I must have used the wrong function to display the textdraw to the player.

Here is my code:

Код:
new Text:Rank;
new Text:XPAmount;

Rank = TextDrawCreate(498.000000, 101.000000, "_"); //Rank Name
TextDrawBackgroundColor(Rank, 255);
TextDrawFont(Rank, 1);
TextDrawLetterSize(Rank, 0.190000, 1.599999);
TextDrawColor(Rank, -559194218);
TextDrawSetOutline(Rank, 0);
TextDrawSetProportional(Rank, 1);
TextDrawSetShadow(Rank, 0);
TextDrawUseBox(Rank, 1);
TextDrawBoxColor(Rank, 71);
TextDrawTextSize(Rank, 607.000000, 0.000000);

XPAmount = TextDrawCreate(582.000000, 101.000000, "_"); //XP Amount
TextDrawBackgroundColor(XPAmount, 255);
TextDrawFont(XPAmount, 1);
TextDrawLetterSize(XPAmount, 0.190000, 1.599999);
TextDrawColor(XPAmount, -16777066);
TextDrawSetOutline(XPAmount, 0);
TextDrawSetProportional(XPAmount, 1);
TextDrawSetShadow(XPAmount, 0);

//TIMER
SetTimer("EXP_Online", XPTime, 1);

//THE EXP_ONLINE
public EXP_Online(playerid)
{
	for(new i; i < MAX_PLAYERS; i++)
	{
   		if(IsPlayerConnected(i))
		{
	 		SetPlayerScore(i, GetPlayerScore(i) + XPPtsPlus);
   		}
	}
}

//ON PLAYER CONNECT
TextDrawShowForPlayer(playerid, Text:Rank);
TextDrawShowForPlayer(playerid, Text:XPAmount);

//ON PLAYER UPDATE
new string[ 128 ];
new XPTD;
XPTD = GetPlayerScore(playerid);
format( string, sizeof string, "%d", XPTD );
TextDrawSetString(XPAmount, string);

GetPlayerXP(playerid);
if(PlayerRank[playerid] == 1)
{
        new string1[ 128 ];
	format(string1, sizeof string1, "Newbie Stunter");
        TextDrawSetString(Rank, string1);
}
if(PlayerRank[playerid] == 2)
{
	new string2[ 128 ];
	format(string2, sizeof string2, "Regular Stunter");
        TextDrawSetString(Rank, string2);
}
The code above is just to show some of the important code of the ranking codes. If you want to know more informations I will add them.

Please help me.
Reply
#2

pawn Код:
for(new i; i < MAX_PLAYERS; i++)
into
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
Edit use the timer in 50 MS, it may cause lag,
Reply
#3

Deleted
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)