SA-MP Forums Archive
[Question] Player or Global TD - 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: [Question] Player or Global TD (/showthread.php?tid=525400)



[Question] Player or Global TD - kizla - 11.07.2014

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..)


Re: [Question] Player or Global TD - theYiin - 11.07.2014

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




Re: [Question] Player or Global TD - kizla - 11.07.2014

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?


Re: [Question] Player or Global TD - theYiin - 11.07.2014

Exactly.