Textdraw :3
#1

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

https://sampwiki.blast.hk/wiki/TextDrawCreate
https://sampwiki.blast.hk/wiki/GetPlayerScore
Reply
#3

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
Reply
#4

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));
Reply
#5

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
Reply
#6

Testing yours now mate, thanks :3
Reply
#7

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
Reply
#8

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"
Reply
#9

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
Reply
#10

What is the "Tag mismatch" lines?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)