Money textdraw!
#1

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.679870359.370605"");
    
TextDrawLetterSize(Textdraw30.2579991.114666);
    
TextDrawAlignment(Textdraw31);
    
TextDrawColor(Textdraw3, -1);
    
TextDrawSetShadow(Textdraw30);
    
TextDrawSetOutline(Textdraw31);
    
TextDrawBackgroundColor(Textdraw351);
    
TextDrawFont(Textdraw31);
    
TextDrawSetProportional(Textdraw31);
//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(stringsizeof(string), "%d"MoneyFor[playerid]);
    
TextDrawSetString(Textdraw3string); 
Reply
#2

Hi
Make as i'm doing:
PHP код:
new Text:Textdraw3[MAX_PLAYERS];

// Then Create it OnGameModeInit
    
for(new playerid 0;playerid MAX_PLAYERSplayerid++)
    {
    
Textdraw3[playerid] = TextDrawCreate(563.679870359.370605""); 
    
TextDrawLetterSize(Textdraw3[playerid], 0.2579991.114666); 
    
TextDrawFont(Textdraw3[playerid], 1); 
    }
//In the command... 

               
MoneyForBail[playerid] = random(7000) + 1000
               if(
MoneyForBail[playerid] > GetPlayerCash(playerid)) 
               { 
               
MoneyFor[playerid] = MoneyForBail[playerid]; 
               
format(stringsizeof(string), "%d"MoneyFor[playerid]); 
               
TextDrawSetString(Textdraw3[playerid], string); 
Hope it works fine
Reply
#3

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

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.679870359.370605"_"); 
Reply
#5

I suggest you using "CreatePlayerTextDraw" and make it global, since every player gonna have different values.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)