SA-MP Forums Archive
Textdraw score with loop - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Textdraw score with loop (/showthread.php?tid=182364)



Textdraw score with loop - nejc001 - 10.10.2010

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.


Re: Textdraw score with loop - Hash [NL-RP] - 10.10.2010

Make your timer update the 3D Text Label.


Re: Textdraw score with loop - Jeffry - 10.10.2010

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.