[Question] Player or Global TD
#1

Should i use PlayerTextDraw or Global TextDraws for creating information about house. Those TD i would use when player pickup house icon and it will show stats about that house (ID, Price, Owned or Not, Owner etc..)
Reply
#2

Both. Use global textdraws, for textdraws, who never changes (like background of that box) and per player textdraws for textdraws, who looks different for every player.

p.s.

NEVER do things like
new Text:gTextDraw[MAX_PLAYERS];

If you need to use array (which size is MAX_PLAYERS) for global textdraws, you do it wrong.

your code should look something like that:

PHP код:
new Text:td_HouseBackground;
new 
PlayerText:ptd_HousePrice[MAX_PLAYERS];
new 
PlayerText:ptd_HouseOwner[MAX_PLAYERS];
new 
PlayerText:ptd_HouseID[MAX_PLAYERS];
stock RandomFunction(playerid)
{
    
// ... random code
    
TextDrawShowForPlayer(playeridtd_HouseBackground);
    
PlayerTextDrawShow(playeridptd_HousePrice[playerid]);
    
PlayerTextDrawShow(playeridptd_HouseOwner[playerid]);
    
PlayerTextDrawShow(playeridptd_HouseID[playerid]);
    
// ... random code

Reply
#3

so house owner and level of house and things like this which can be changed from house to house it should be player textdraw and background should be global?
Reply
#4

Exactly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)