textdraw problem - 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)
+--- Thread: textdraw problem (
/showthread.php?tid=333803)
textdraw problem -
Face9000 - 12.04.2012
Hello,i created this small textdraw to show at bottom of the screen the player wanted level.But doesnt work.
pawn Код:
[new Text:WantedTxd0;
new Text:WantedTxd1;
OnGameModeInit:
pawn Код:
WantedTxd0 = TextDrawCreate(526.000000, 430.000000, "Wanted Level:");
TextDrawBackgroundColor(WantedTxd0, 255);
TextDrawFont(WantedTxd0, 3);
TextDrawLetterSize(WantedTxd0, 0.320000, 1.100000);
TextDrawColor(WantedTxd0, -16776961);
TextDrawSetOutline(WantedTxd0, 1);
TextDrawSetProportional(WantedTxd0, 1);
WantedTxd1 = TextDrawCreate(621.000000, 430.000000, "0");
TextDrawBackgroundColor(WantedTxd1, 255);
TextDrawFont(WantedTxd1, 3);
TextDrawLetterSize(WantedTxd1, 0.320000, 1.100000);
TextDrawColor(WantedTxd1, -16776961);
TextDrawSetOutline(WantedTxd1, 1);
TextDrawSetProportional(WantedTxd1, 1);
OnPlayerConnect:
pawn Код:
TextDrawShowForPlayer(playerid, WantedTxd0);
TextDrawShowForPlayer(playerid, WantedTxd1);
new wantedtext[20];
GetPlayerWantedLevel(playerid);
format(wantedtext, sizeof(wantedtext), "%d",PlayerInfo[playerid][pWantedLevel]);
TextDrawSetString(WantedTxd1, wantedtext);
I tried with a wanted level and it shows only Wanted Level: 0
Why??
P.S PlayerInfo[playerid][pWantedLevel] is the function i use to save wanted level.
Re: textdraw problem -
ViniBorn - 12.04.2012
Wouldn't be :
pawn Код:
new wantedtext[20];
format(wantedtext, sizeof(wantedtext), "%d",GetPlayerWantedLevel(playerid));
TextDrawSetString(WantedTxd1, wantedtext);
Re: textdraw problem -
Face9000 - 12.04.2012
Already tried and it doesnt work...
Re: textdraw problem -
MP2 - 12.04.2012
You're creating ONE GLOBAL textdraw. You need to create it per-player.
Re: textdraw problem -
Face9000 - 12.04.2012
Quote:
Originally Posted by MP2
You're creating ONE GLOBAL textdraw. You need to create it per-player.
|
So i need to use a loop?
Re: textdraw problem -
ViniBorn - 12.04.2012
PlayerInfo[playerid][pWantedLevel] is loaded when player connect?
Quote:
Originally Posted by Logitech90
So i need to use a loop?
|
Yes.
Re: textdraw problem -
MP2 - 12.04.2012
No you don't need to use a loop. You need to have an array to store the textdraw ID in, you need to create it under OnPlayerConnect, destroy it under OnPlayerDisconnect and update it when you set their wanted level.
Re: textdraw problem -
Face9000 - 12.04.2012
Quote:
Originally Posted by MP2
No you don't need to use a loop. You need to have an array to store the textdraw ID in, you need to create it under OnPlayerConnect, destroy it under OnPlayerDisconnect and update it when you set their wanted level.
|
I already destroy the textdraw at onplayerdisconnect,and for updating it,that's why i used pWantedLevel because it autoupdates at the players stats.
Can you show me an example about the array to store the textdraw id?
Quote:
@Viniborn: PlayerInfo[playerid][pWantedLevel] is loaded when player connect?
|
It loads after a player login (when a player connects it asks for login in account).
Re: textdraw problem -
Face9000 - 14.04.2012
Bump.