• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HudElem Position
#1
Hello,

i have a problem with the postioning of HudElem objects.
When i wan't to set a HudElem (in this case: HUD_Text) for example on the right of another HudElem (in this case: HUD_Icon) it doesn't seem to calculate correct since the HUD_Text is inside the HUD_Icon instead of at the right.
Also the position of Hud Elements alter on Clients too.

My Calculation of the X-Position for HUD_Text is:
CSHARP Code
  1. HUD_Text.OriginX = HUD_Icon.OriginX + HUD_Icon.IconWidth


I think the problem lies in different client-sided screen resolutions.
So is it possible 1. to get the real coordinates/sizes of HudElem objects from a certain client or 2. to get screen values from a client?
If not @zxz0O0 could you implement that?

Example on Usage (Solution 1):
CSHARP Code
  1. HUD_Icon.SetPosition(10, 100, client.ClientNum) //10 = x, 100 = y, ClientNum for screen calculation

Example on Usage (Solution 2):
CSHARP Code
  1. HUD_Icon.OriginX = client.ScreenRectangle.Right - HUD_Icon.IconWidth


Or is there a other way to get the right Position for every clients? Maybe i just missed something Angel
  Reply
#2
Have you tried both SetString and SetLabel?

There isn't anyway to check for screen resolution or something, you need to use PointType but I've never found out how it works exactly. Just try a bit yourself and find the most close point to your absolute point.
[Image: azuw.jpg]
  Reply
#3
(08-03-2012, 10:10)zxz0O0 Wrote: Have you tried both SetString and SetLabel?

There isn't anyway to check for screen resolution or something, you need to use PointType but I've never found out how it works exactly. Just try a bit yourself and find the most close point to your absolute point.

The String and Label is both at the same position, so yes i tried both.
I still don't get what PointType means but ok, good to know that it has something to do with that.
Thx, i'll try playing with PointType
  Reply
#4
@Deviler86 If i'm not wrong, SetLabel is used for the label of the hud and SetString is used as a 'text' value if hud.Type = HudElementTypes.Text;
So if you want a string value that will frekently change use SetString not SetLabel (Someone mentionned a server crash with SetLabel abuse in a post i forgot ( Maybe @zxz0O0 ? ))

I'm also searching for a way to find the client screen size... so if someone know how to get it please share it Wink

[Edit]
In a plugin i've done, i used hudelement to show infos the players, i used hud.PointType = 0; for all of them and i changed only the hud.OriginY and hud.OriginX and the display was the same in 1920x1080 and 640x480
  Reply
#5
(08-03-2012, 19:45)narkos Wrote: @Deviler86 If i'm not wrong, SetLabel is used for the label of the hud and SetString is used as a 'text' value if hud.Type = HudElementTypes.Text;
So if you want a string value that will frekently change use SetString not SetLabel (Someone mentionned a server crash with SetLabel abuse in a post i forgot ( Maybe @zxz0O0 ? ))

I'm also searching for a way to find the client screen size... so if someone know how to get it please share it Wink

[Edit]
In a plugin i've done, i used hudelement to show infos the players, i used hud.PointType = 0; for all of them and i changed only the hud.OriginY and hud.OriginX and the display was the same in 1920x1080 and 640x480

thx for the reply. The Reason i'm using SetLabel AND SetString is because i want different sizes of the Text. The text in SetLabel is a lil bigger than the text in SetString. I could use two HudElems for that, but i think thats better ^^.
Since i don't have server crashes with SetLabel i'll stick to that, but if i notice problems i think i'll reconsider ^^

I'll try setting PointType to '0' too. I'm currently using '81' which i saw in another plugin (don't know which).
Thx for the tipp
  Reply
#6
(08-03-2012, 19:45)narkos Wrote: @Deviler86 If i'm not wrong, SetLabel is used for the label of the hud and SetString is used as a 'text' value if hud.Type = HudElementTypes.Text;
So if you want a string value that will frekently change use SetString not SetLabel (Someone mentionned a server crash with SetLabel abuse in a post i forgot ( Maybe @zxz0O0 ? ))
Changing text too often, no matter if label or text will eventually crash the server since every new string is allocated in the memory.
[Image: azuw.jpg]
  Reply
#7
@zxz0O0 you mean that if i have a hud with a text like "hi all" then i change it to "hello everyone" the old text "hi all" still present in the memory?
  Reply
#8
(08-04-2012, 09:23)zxz0O0 Wrote:
(08-03-2012, 19:45)narkos Wrote: @Deviler86 If i'm not wrong, SetLabel is used for the label of the hud and SetString is used as a 'text' value if hud.Type = HudElementTypes.Text;
So if you want a string value that will frekently change use SetString not SetLabel (Someone mentionned a server crash with SetLabel abuse in a post i forgot ( Maybe @zxz0O0 ? ))
Changing text too often, no matter if label or text will eventually crash the server since every new string is allocated in the memory.

overflow -501 error?
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  write flag position map [HARD] Tony. 4 3,101 05-30-2013, 10:05
Last Post: hillbilly
Question Help position [HARD] Tony. 2 1,770 05-14-2013, 18:06
Last Post: [HARD] Tony.
  Help HUDElem's "disappear". DidUknowiPwn 12 5,464 10-31-2012, 17:30
Last Post: DidUknowiPwn
  Preview HudElem in game [Z00MBY] Alex 1 1,906 08-05-2012, 23:16
Last Post: Nekochan
  Help HudElem disappear after map changes narkos 4 2,452 08-03-2012, 20:21
Last Post: narkos

Forum Jump:


Users browsing this thread: 1 Guest(s)