Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HudElem Position
08-03-2012, 01:28
Post: #1
HudElem Position
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
Related links
Find all posts by this user
Add Thank You Quote this message in a reply
08-03-2012, 10:10
Post: #2
RE: HudElem Position
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]
Find all posts by this user
Add Thank You Quote this message in a reply
08-03-2012, 17:56
Post: #3
RE: HudElem Position
(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
Find all posts by this user
Add Thank You Quote this message in a reply
08-03-2012, 19:45 (This post was last modified: 08-03-2012 20:04 by narkos.)
Post: #4
RE: HudElem Position
@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
Related links
Find all posts by this user
Add Thank You Quote this message in a reply
08-04-2012, 02:34
Post: #5
RE: HudElem Position
(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
Find all posts by this user
Add Thank You Quote this message in a reply
08-04-2012, 09:23
Post: #6
RE: HudElem Position
(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]
Find all posts by this user
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to zxz0O0 for this post:
SailorMoon (08-04-2012)
08-04-2012, 15:22 (This post was last modified: 08-04-2012 15:25 by narkos.)
Post: #7
RE: HudElem Position
@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?
Find all posts by this user
Add Thank You Quote this message in a reply
08-04-2012, 16:19
Post: #8
RE: HudElem Position
(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?
Related links

Steam: jaydi2112
[Image: userbar7q.gif]
[Image: 45296.png]
[Image: 3OM7E.gif]
Visit this user's website Find all posts by this user
Add Thank You Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Preview HudElem in game [Z00MBY] Alex 1 344 08-05-2012 23:16
Last Post: SailorMoon
  Help HudElem disappear after map changes narkos 4 359 08-03-2012 20:21
Last Post: narkos

Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Media Embeding by Simple Audio Video Embeder