Compass
2 Attachment(s)
Compass http://www.pcs-gaming.com/fastdl/cstrike/compass.jpg - What is it? - To simply put it, this works like a compass. As you can see from the image above, this will change your HUD by adding an indicator which is in the area of the cardinal directions. Additionally, it will also display which direction you are facing using the standard N 45W. - Other Applications - This plugin could be used for a GPS style plugin to find objects or players. For example, if you could grab a players angle to a flag in CTF, then this plugin could help you with where that flag is in relation to you without being able to see the location of the flag. - CVARS - Quote:
|
Re: Compass
This should be in "New Plugin Submissions" and not in "Code Snippets/Tutorials".
Braces starting on Line 42 serve no purpose. You shouldn't recreate variables on prethink if you can avoid it, you can use static variables instead. You should try to minimize all native calls by caching values if possible (like cvars). |
Re: Compass
I don't consider this a full plugin worthy of submission, because I see no complete purpose to it. I just think it could be useful to anyone who might be making a GPS-style plugin where they need to find stuff. Like a geo-cache mod or locating a player. I think that this was better suited if somebody needed code for a compass, not as a single addon that is a compass. I mean, what the hell would that accomplish ingame other then knowing what direction you are facing.
While the braces on line 42 server no purpose to the code, they help my eyes see what part handles the actual angle->hud float conversions. I cached one of the variables, but not the other because I didn't think it was necessary because it was only being questioned once. What do you mean by recreating variables? Do you mean that I should make them all global? Thank you for your comments, I really appreciate you taking your time to go through my code and help me. |
Re: Compass
More:
There are two places that I see that a switch would be more efficient. You should only need to do if(method) once because if method is 0 then nothing happens anyways (except for the very last hud message) so why do anything? Also, it looks like when you are pointing only in one of the cardinal directions it uses whole words but if you move 1 degree then it switches to short names. So, this would make it look like the full names pop up every so often and not look consistent. Quote:
By recreating variables I mean that when you use "new" it creates the variable then when the function is complete the variable is destroyed. Repeat thousands of times per second*. You should be able to use static variabls. * I'm not sure about the 1000 times per second but it's sure is a lot. |
Re: Compass
Quote:
I will also try and reduce the variables as much as I can. Your suggestion for the switch was for the cardinal checks and the degree method? |
Re: Compass
Quote:
|
Re: Compass
Awesome plugin
Good JOB |
Re: Compass
You gave me an idea with this plugin. I will release a good one soon.
Good job. And also good idea. |
Re: Compass
I was considering how to find a players, and this idea is awesome. Thanks.
|
Re: Compass
You would just have to find the angle your facing relative to their position. I assume adding in another HUD channel or something to mark their direction
Uploaded new version at first post. I added the brackets that are there for no reason to know what code handles the horizontal movement. I had ambitions for adding in vertical ones as well. I guess I had a theory that this could work out to be a wallhack of sorts if need be, or a more accurate method of seeing your object. |
All times are GMT -4. The time now is 21:27. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.