Money textdraw! - 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: Money textdraw! (
/showthread.php?tid=657882)
Money textdraw! -
Thanks - 16.08.2018
I've creating a textdraws for a player To show him the amount he must payed but After The player show the textdraw he don't even see the price why? To remember you I've creating a textdraws..
PHP код:
// The textdraw created
Textdraw3 = TextDrawCreate(563.679870, 359.370605, "");
TextDrawLetterSize(Textdraw3, 0.257999, 1.114666);
TextDrawAlignment(Textdraw3, 1);
TextDrawColor(Textdraw3, -1);
TextDrawSetShadow(Textdraw3, 0);
TextDrawSetOutline(Textdraw3, 1);
TextDrawBackgroundColor(Textdraw3, 51);
TextDrawFont(Textdraw3, 1);
TextDrawSetProportional(Textdraw3, 1);
//In the command...
MoneyForBail[playerid] = random(7000) + 1000;
if(MoneyForBail[playerid] > GetPlayerCash(playerid))
{
MoneyFor[playerid] = MoneyForBail[playerid];
//In the public But it's not working.. They always shown 0 or -1 the amount
format(string, sizeof(string), "%d", MoneyFor[playerid]);
TextDrawSetString(Textdraw3, string);
Re: Money textdraw! -
TadePoleMG - 17.08.2018
Hi

Make as i'm doing:
PHP код:
new Text:Textdraw3[MAX_PLAYERS];
// Then Create it OnGameModeInit
for(new playerid = 0;playerid < MAX_PLAYERS; playerid++)
{
Textdraw3[playerid] = TextDrawCreate(563.679870, 359.370605, "");
TextDrawLetterSize(Textdraw3[playerid], 0.257999, 1.114666);
TextDrawFont(Textdraw3[playerid], 1);
}
//In the command...
MoneyForBail[playerid] = random(7000) + 1000;
if(MoneyForBail[playerid] > GetPlayerCash(playerid))
{
MoneyFor[playerid] = MoneyForBail[playerid];
format(string, sizeof(string), "%d", MoneyFor[playerid]);
TextDrawSetString(Textdraw3[playerid], string);
Hope it works fine
Re: Money textdraw! -
Banditul18 - 17.08.2018
Quote:
Originally Posted by TadePoleMG
Hi 
Make as i'm doing:
Hope it works fine 
|
A suggestion for your code. Dont create like that per player textdraws. Just create the textdraw when the player connect, dont waste so many textdraw slots just for lets say 20/50 players that will connect in next hour
Also use PlayerTextdraws for per player textdraw, its far better
Re: Money textdraw! -
AmigaBlizzard - 17.08.2018
Also some tip is to read the important notes here:
https://sampwiki.blast.hk/wiki/TextDrawCreate
It says the text cannot be empty or your server may crash.
Use the underscore to at least have something in your textdraw upon creation:
PHP код:
Textdraw3 = TextDrawCreate(563.679870, 359.370605, "_");
Re: Money textdraw! -
severance - 17.08.2018
I suggest you using "CreatePlayerTextDraw" and make it global, since every player gonna have different values.