hello everybody, I am here to present the tutorial for how to make text on screen like zomie mods(cash and health)
1.Important thing
the information could help you making text screen properly
so you see:
Code:
self.newtext setText("here:" + self.perks);
so you could see above, right?
anyway you see the 'here' in quotes "" that cuz 'here' is unique text, like in C++ you must put quotes cuz word 'here' is not value, this is memory varaible(see https://www.mpgh.net/forum/279-call-d...s-structs.html)
but you see the plus with value?this is addition with integer value, so in-game it will be like this if self.perks is equals 1:
2.beginning
creating and locating input text:
first, you must add new hud element like:
Code:
onPlayerSpawned()
{
self endon("disconnect");
self.showpage = NewClientHudElem( self );
self.showpage.alignX = "center";
self.showpage.alignY = "bottom";
self.showpage.horzAlign = "center";
self.showpage.vertAlign = "bottom";
self.showpage.y = -25;
self.showpage.foreground = true;
self.showpage.fontScale = 0.9;
self.showpage.font = "objective";
self.showpage.color = ( 1.0, 2.0, 1.0 );
instead of showpage, you could name it anything else like 'newtext', but all other struct must have same name as struction like:
Code:
self.newtext = NewClientHudElem( self );
self.newtext.alignX = "center";
self.newtext.alignY = "bottom";
and like this, congrats you created basic input text
and you see, there is new structs with dot (.), this is structing the new hud elem, here is what text writing onscreen must have
Code:
self.newtext.alignX
you see the alignX struct? this is to anchor locate where you put self.newtext .... Horizontal
but you see thats it assigned with "center"
it means anchor the text in center in horizon
the list of aligning point is:
"center"
"left"
"right"
and you see
this is also required struct, this is for VERTICAL
the list of variables assigning it for achor:
"middle"
"top"
"bottom"
but you see the
this is same to alignX but must be either existed and must same to alignX (you,ve put alignX in center and you must put center also to horzAlign)
and
is same but for alignY
lesson 3:
coordinates:
so you see struct
this is not anchor point of text, this is to move the text vertical by float number
the float number is BIG, it could have decimal
1.2
and it could be negative and positive!
-1.2
but you are asking, you already put the center in alignY, but this is to change
it just like telling your brother to sit in center of room but after minutes you told him to move a little
but you see, moving text a little must have much bigger number for example you put .y = 50, but it didn't put at the point you want, then you put .y = 51, you will NEVER see the point changed, so you make it .y = 100, and soon you will see it moved a LITTLE
the positive float number to move down from anchor point, and the negative to move up from anchor point
note:this struct could be optional
and
you see the optional coordinate struct is
this more like .y but to move horizontal, and negative to move left and positive to move right
lesson 4:
ending and creating
and the required struct is
the font is font style, list of font style
"default", // HE_FONT_DEFAULT
"bigfixed", // HE_FONT_BIGFIXED
"smallfixed",// HE_FONT_SMALLFIXED
"objective"
"hudbig"
and either required struct is
this is font size, and could be positive float number
NOTE:the font size is much different then coordinate pointing, just change it a bit and it will be bigger that you could see the difference
ppl mostly use only
X.X number (X is any number digit)
and you see the structs
just copy and paste from example I either IDK
Ending:
and you have command for texting and output and it could be in after playerspawned, and it could be change-able,
Code:
self.newtext setText("text");
and you could change it for example while the player is in this place
Code:
self.newtext setText("change");
hope helped
PRESS THANKS BUTTON