What's wrong -
Face9000 - 01.06.2011
I got this part of code for creating textdraw and show's how much score has a player:
pawn Код:
new tds[128];
format(tds, sizeof(tds), "Score: %d",GetPlayerScore(playerid));
Textdraw1[playerid] = TextDrawCreate(276.000000, 391.000000, tds);
TextDrawShowForPlayer(playerid, tds[playerid]);
TextDrawBackgroundColor(tds, 255);
TextDrawFont(tds, 1);
TextDrawLetterSize(tds, 0.500000, 1.799999);
TextDrawColor(tds, -1);
TextDrawSetOutline(tds, 0);
TextDrawSetProportional(tds, 0);
TextDrawSetShadow(tds, 1);
But i get this:
warning 213: tag mismatch
error 035: argument type mismatch (argument 1)
Thanks.
Re: What's wrong -
Hobod - 01.06.2011
Re: What's wrong -
Face9000 - 01.06.2011
Quote:
Originally Posted by Hobod
|
Already added,it's not that the problem.
Re: What's wrong -
Hobod - 01.06.2011
which lines are those errors on?
Re: What's wrong -
Calgon - 01.06.2011
pawn Код:
new
szTextdrawMessage[12],
Text: tTextdraw; // this needs to be a global variable
tTextdraw = TextDrawCreate(276.000000, 391.000000, "Score: 0");
TextDrawBackgroundColor(tTextdraw, 255);
TextDrawFont(tTextdraw, 1);
TextDrawLetterSize(tTextdraw, 0.500000, 1.799999);
TextDrawColor(tTextdraw, -1);
TextDrawSetOutline(tTextdraw, 0);
TextDrawSetProportional(tTextdraw, 0);
TextDrawSetShadow(tTextdraw, 1);
format(szTextdrawMessage, sizeof(szTextdrawMessage), "Score: %d", GetPlayerScore(playerid));
TextDrawSetString(tTextdraw, szTextdrawMessage);
TextDrawShowForPlayer(playerid, tTextdraw);
You can't show the textdraw before you've set the effects and expect them to show, plus your code was generally illogical and a complete mess - this changed code will set the score to 0 in the textdraw then get the real score once the textdraw has been made and will show it to the player.
You want to show the score to a player or update it, use this code:
pawn Код:
new
szTextdrawMessage[12];
format(szTextdrawMessage, sizeof(szTextdrawMessage), "Score: %d", GetPlayerScore(playerid));
TextDrawSetString(tTextdraw, szTextdrawMessage);
TextDrawShowForPlayer(playerid, tTextdraw);
Re: What's wrong -
Biesmen - 01.06.2011
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:
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);
But there's still a problem, you will have to create the textdraw at "OnGameModeInit".
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;
}
Edit: lol, Calgon was too fast.
Re: What's wrong -
Unknown_Killer - 01.06.2011
try this one
pawn Код:
new tds[128];
format(tds, sizeof(tds), "Score: %d",GetPlayerScore(playerid));
Textdraw1[playerid] = TextDrawCreate(276.000000, 391.000000, tds);
TextDrawShowForPlayer(playerid, tds[playerid]);
TextDrawBackgroundColor(tds[playerid], 255);
TextDrawFont(tds[playerid], 1);
TextDrawLetterSize(tds[playerid], 0.500000, 1.799999);
TextDrawColor(tds[playerid], -1);
TextDrawSetOutline(tds[playerid], 0);
TextDrawSetProportional(tds[playerid], 0);
TextDrawSetShadow(tds[playerid], 1);
Re: What's wrong -
Calgon - 01.06.2011
Your code won't work Unknown_Killer (it doesn't solve the original issue), neither will yours Biesmen (it's silly code - you're trying to set a textdraw on people who aren't connected - ongamemodeinit initiates before players connect and you're making hundreds of useless textdraws when you only really need one).
Re: What's wrong -
Biesmen - 01.06.2011
Well, Calgon, if you'd mind to refresh your page before commenting
Re: What's wrong -
Calgon - 01.06.2011
I have done.