01.06.2011, 09:09
You're defining TDS, which is a string.
Then you're saying Textdraw1[playerid] = TextdrawCreate(...).
And then you want to modify the TDS string.
So, this is the correct code:
But there's still a problem, you will have to create the textdraw at "OnGameModeInit".
Edit: lol, Calgon was too fast.
Then you're saying Textdraw1[playerid] = TextdrawCreate(...).
And then you want to modify the TDS string.
So, this is the correct code:
pawn Код:
//Make sure Textdraw1 is defined as: new Text:Textdraw1[MAX_PLAYERS];
new tds[128];
format(tds, sizeof(tds), "Score: %d",GetPlayerScore(playerid));
Textdraw1[playerid] = TextDrawCreate(276.000000, 391.000000, tds);
TextDrawBackgroundColor(Textdraw1[playerid], 255);
TextDrawFont(Textdraw1[playerid], 1);
TextDrawLetterSize(Textdraw1[playerid], 0.500000, 1.799999);
TextDrawColor(Textdraw1[playerid], -1);
TextDrawSetOutline(Textdraw1[playerid], 0);
TextDrawSetProportional(Textdraw1[playerid], 0);
TextDrawSetShadow(Textdraw1[playerid], 1);
pawn Код:
public OnGameModeInit()
{
//blablabla
foreach(Player, playerid)
{
Textdraw1[playerid] = TextDrawCreate(276.000000, 391.000000, "_");
TextDrawBackgroundColor(Textdraw1[playerid], 255);
TextDrawFont(Textdraw1[playerid], 1);
TextDrawLetterSize(Textdraw1[playerid], 0.500000, 1.799999);
TextDrawColor(Textdraw1[playerid], -1);
TextDrawSetOutline(Textdraw1[playerid], 0);
TextDrawSetProportional(Textdraw1[playerid], 0);
TextDrawSetShadow(Textdraw1[playerid], 1);
}
return 1;
}
//I hope you have a login system which will give them their score.
//If you want to update your textdraw frequently, set a timer.
public OnPlayerSpawn(playerid)
{
new tds[128];
format(tds, sizeof(tds), "Score: %d",GetPlayerScore(playerid));
TextDrawSetString(Textdraw1[playerid], tds);
TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
return 1;
}