Textdraw score with loop
#1

Now in my script i have like this:
Код:
forward tdscoretimer(playerid);
new tdscore;


public tdscoretimer(playerid)
{
		tdscore = GetPlayerScore(playerid);
		return 1;
		}


public OnGameModeInit()
{
 SetTimer("tdscoretimer", 5000, true);

	new tds[128];
	format(tds, sizeof(tds), "Score:%d",tdscore);
	Textdraw1 = TextDrawCreate(498.000000, 118.000000, tds);
	

	for(new i; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(i))
		{
			TextDrawShowForPlayer(i, Textdraw0);
			TextDrawShowForPlayer(i, Textdraw1);
		}
		}
return 1;
}
I know i failed somewhere, i have no errors, just when i spawn it says "Score:0" whole time.
Reply
#2

Make your timer update the 3D Text Label.
Reply
#3

pawn Код:
forward tdscoretimer(playerid);
new tdscore[MAX_PLAYERS];
new Textdraw1[MAX_PLAYERS];

public tdscoretimer()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new tds[128];
            format(tds, sizeof(tds), "Score:%d",GetPlayerScore(i));
            TextDrawSetString(Textdraw1[i], tds);
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    new tds[128];
    format(tds, sizeof(tds), "Score:%d",GetPlayerScore(playerid));
    Textdraw1[playerid] = TextDrawCreate(498.000000, 118.000000, tds);
    TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    TextDrawDestroy(Textdraw1[playerid]);
    return 1;
}

public OnGameModeInit()
{
    SetTimer("tdscoretimer", 5000, true);
    return 1;
}
Try this.

Greetz.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)