Get map size (width and length) and player positions
I'm making a plugin and I want to display a live preview of the game on my website.
On top of a map image, i want to display the exact position of each player (updated every 5 seconds). I can use get_user_origin() function to get the player position and it returns something like this: -1060 1118 -4 I presume first 2 numbers are the X and Y coordinates on the map and the last one is the height where the player is? Can someone confirm this? I also need to get the map size (width and length) so I can position the players over the map image preview properly. I couldn't find a function for that. Can anyone help? |
Re: Get map size (width and length) and player positions
Why are the coordinates with minus sometimes? Do they represent the position relative to the center of the map?
|
Re: Get map size (width and length) and player positions
Quote:
|
Re: Get map size (width and length) and player positions
The coordinates are based on the 3D cartesian coordinate system where the origin is at some arbitrary location in the map, it really depends on where the original map developer started creating the map elements. And, yes, the third coordinate is the Z axis which is the vertical position (relative to the origin).
|
Re: Get map size (width and length) and player positions
Is there any way to find out where the corners of the map are, to somehow pin point where a player is located on it?
Is there any way to teleport myself to a certain location, maybe some kind of plugin? I could teleport to 0, 0 coordinates to find the center then figure out where everything else is located ... |
Re: Get map size (width and length) and player positions
corners of the map no, but the origin of the map YES :)
and as you can see the overview of the map is transferred from units to photo size in pixels depending on the view aspect... and the overview of the map width and height are constant which is 1024x768 |
Re: Get map size (width and length) and player positions
If you're curious about coordinates of a map, you might be interested in using BSPViewer. You can float around and it will tell you your origin (the location of your viewport in the map).
While it is possible to write a plugin to teleport to the origin, it won't actually be that useful IMO, I would just use BSPViewer. Regardless, I don't think you even need to do this because, as Natsheh said, the data you need is in the TXT file that comes with the overview of the map (you'll need to use that overview or one that is equivalent for the image you're planning on putting your player locations on). If you look up on how to make overviews, it will probably have some good info for what you're trying to do (because you are literally doing exactly what the game does already in the minimap). |
Re: Get map size (width and length) and player positions
Here're some useful references from the Xash3D engine code.
https://github.com/FWGS/xash3d/blob/...ient/cl_view.c https://github.com/FWGS/xash3d/blob/...t/gl_backend.c |
Re: Get map size (width and length) and player positions
The game doesn't show the overview and players properly though.
They appear to be moving inside the walls or even going out of the map all the time. Are the coordinates displayed in bspviewer accurate? I'm thinking I can make a list of coordinates on the counter-strike map and the coresponding pixel in the overview picture. (for example bomb sites, team bases, corners of the map) Then I can calculate the places between. I'm gonna give it a try but if it's too complicated and unreliable, I will probably give up. I thought it would be a lot more easier to do it. bspviewer gives some errors (memory could not be read) and crashes sometimes ... |
Re: Get map size (width and length) and player positions
This is a little bit unethical but give netshark cs 1.6 cheat a try, they have overviews of the map with player locations pretty accurate, maybe you can figure out how to do it too.
My guess is that you can just set the origin of the map to be 0.0.0 aka center of an image, and set the boundaries to be the corners of the map(you can get the origins by manually going in the corners of the maps you want), and then u just draw the playerdot at closest_corner - player_location, sounds easy enough (it always does but then u get to do it...) Also check this out too: https://forums.alliedmods.net/showpo...8&postcount=20 note that this will probably get ALL the corners even if unreachable by player. |
| All times are GMT -4. The time now is 15:43. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.