SA-MP Forums Archive
Textdraw :3 - 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 :3 (/showthread.php?tid=265937)



Textdraw :3 - iGetty - 03.07.2011

Alright, could somebody help me with creating a textdraw, that updates the players score? :3, just under the player money, if possible :3, thanks!


Re: Textdraw :3 - =WoR=Varth - 03.07.2011

https://sampwiki.blast.hk/wiki/TextDrawCreate
https://sampwiki.blast.hk/wiki/GetPlayerScore


Re: Textdraw :3 - iGetty - 03.07.2011

I know that, but I don't know how to get it on the top right of my screen :3, and I don't really understand how to make the score update on a textdraw :3


Re: Textdraw :3 - =WoR=Varth - 03.07.2011

If you want to put it in top of your screen, try some coordinate until you get the fit place.
To show the score update you can just simply:
pawn Код:
TextDrawSetString(Your text draw name,GetPlayerScore(playerid));



Re: Textdraw :3 - Laronic - 03.07.2011

pawn Код:
new Text:ScoreTD[MAX_PLAYERS];

public OnGameModeInit()
{
    ScoreTD[playerid] = TextDrawCreate(240.0, 580.0, "~r~Your score: _");
    return 1;
}

stock GivePlayerScore(playerid, score)
{
    new string[1 + 6 + 18];
    format(string, sizeof(string), "~r~Your score: ~w~%i", score);
    TextDrawSetString(ScoreTD[playerid], string);
    return SetPlayerScore(playerid, GetPlayerScore(playerid) + score));
}

//\\o_+
//\\Replace there you give someone score with "GivePlayerScore"
//\\You maybe have "SetPlayerScore(playerid, GetPlayerScore(playerid) + 1));"
//\\Change that to "GivePlayerScore(playerid, 1);"
Edit: PS: You must add TextDrawShowForPlayer somewhere, like on OnPlayerSpawn


Re: Textdraw :3 - iGetty - 03.07.2011

Testing yours now mate, thanks :3


Re: Textdraw :3 - iGetty - 03.07.2011

Tested it, and I got errors, I can't add it to OnGameModeInit(); because of the playerid, so I tried it in OnPlayerConnect(playerid), and it just doesn't show? :3, please help :3


Re: Textdraw :3 - Laronic - 03.07.2011

Quote:
Originally Posted by getty154
Посмотреть сообщение
Tested it, and I got errors, I can't add it to OnGameModeInit(); because of the playerid, so I tried it in OnPlayerConnect(playerid), and it just doesn't show? :3, please help :3
oh, yeah thats right.

Add "TextDrawShowForPlayer(ScoreTD[playerid]);" under "OnPlayerSpawn"


Re: Textdraw :3 - iGetty - 03.07.2011

I got 2 warnings with that, Tag mismatch, and another :3, I had to change it to this,

TextDrawShowForPlayer(playerid, ScoreTD[playerid]);


Now I am testing it :3

EDIT: I tested it, and it's still now showing :O


Re: Textdraw :3 - Laronic - 03.07.2011

What is the "Tag mismatch" lines?