Raised This Month: $ Target: $400
 0% 

Getting cvars and getting spectating target.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mind
Junior Member
Join Date: May 2005
Location: Sweden
Old 05-09-2005 , 02:40   Getting cvars and getting spectating target.
Reply With Quote #1

Hi, Im quite new on the amxx modding scene, I aim mostly at modding counterstrike. My latest experience in modding was in quake 1 where I did a lot of custom stuff like complete sets of new weapons, rules, models and the whole shabang.

I most confess I got stuck on some very basic stuff that I cant figure out how to solve, I guess it is probably very easy if you know how, it usually is but in the beginning you have to get a "feel" for the new enviroment.

I have tried searching the forums and checking various tutorials and checking other peoples plugins but the answer still eludes me.

The problem:

1. I need to read a players cvars, more specifically, I need to check if a user have reverse mouse on or not. This is in the cvar m_pitch which is a float. If it is negative then the user has reverse mouse on. I need to check this in order to properly set it back later so I donīt mess the players setting up. I have not found a way to check users cvars in general.

2. I need to get hold of the player I am currently spectating. I am thinking about some various anti-cheat plugins and cheat-detection methods but I need to get the player I am spectating (as an admin) as a player number or perhaps as a target entity. I found it cumbersome running plugins affecting players by referring their name and so on, It would be much more easy for the admin to simply have it affect the player he is currently spectating.

Thanks in advance!
/Mind
Mind is offline
Send a message via ICQ to Mind
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 05-12-2005 , 15:33   Re: Getting cvars and getting spectating target.
Reply With Quote #2

Quote:
Originally Posted by Mind
1. I need to read a players cvars, more specifically, I need to check if a user have reverse mouse on or not. This is in the cvar m_pitch which is a float. If it is negative then the user has reverse mouse on. I need to check this in order to properly set it back later so I donīt mess the players setting up. I have not found a way to check users cvars in general.
I found both get_cvar_float() and set_cvar_float() here under 'Function Reference' and then 'Core'.
Brad is offline
twistedeuphoria
Veteran Member
Join Date: Jul 2004
Old 05-12-2005 , 15:55  
Reply With Quote #3

Those are for server cvars, AFAIK there is no way to get most if not all of a client's cvars.
__________________
twistedeuphoria is offline
sambro
Member
Join Date: May 2005
Old 05-12-2005 , 19:43  
Reply With Quote #4

If you're wanting to get their m_pitch:

Quote:
new tempPitch[32];
get_user_info(id, "m_pitch", tempPitch, 31);
new Float:mousePitch = floatstr(tempPitch);
Voila!

As far as the spectator thing goes, I can't help you there. There IS a set_view command, which sets your view to chase someone else, but there doesn't seem to be a get_view.

Perhaps there's a entry in the entity structure. Check out the engine_const.inc and see if you can find it there

Hope I helped.
sambro is offline
Send a message via MSN to sambro
Mind
Junior Member
Join Date: May 2005
Location: Sweden
Old 05-15-2005 , 03:17  
Reply With Quote #5

Thanks a million! =)

One less problem to solve

Strange thing, I actually looked at that exakt command but never got it working, and I see now that I read your example that I simply misunderstood how it worked =)
Mind is offline
Send a message via ICQ to Mind
Mind
Junior Member
Join Date: May 2005
Location: Sweden
Old 05-15-2005 , 06:20  
Reply With Quote #6

Hmm... on second thought, now that I tried it out, it doesnt seem to work.

I took this:

Code:
new tempPitch[32]; get_user_info(id, "m_pitch", tempPitch, 31); new Float:mousePitch = floatstr(tempPitch);

and made sure all the parameters are what they are supposed to be, like id in get_user_info should be index and so on..

when it didnt work (it compiled ok but I didnt get any value what so ever from m_pitch) I tried tweaking and changing and all sorts of stuff just to make sure that I didnt screw up somewhere else.

If I take this code:

Code:
new tempPitch[32]; get_user_info(id, "m_pitch", tempPitch, 31);

I should be able to print it out with client_print... right?
I tried typing out other stringvariables with it and it worked ok, but not when I try to type tempPitch.

Take this snippet for example
Code:
   new test[32];    new test2[32];    copy(test2, 6, "Hello");    get_user_info(id, "m_pitch", test, 31);    client_print( target , print_notify , "Test is:%s ", test);    client_print( target , print_notify , "Test2 is:%s ", test2);

It prints out:
Test is: Test2 is:Hello

So the variable test is actually never getting anything. I figured I made something wrong with index or so... so I made damn sure I had playerindex there by using get_user_index(arg) where arg was the playername.

Anyone have any suggestions on this?
Mind is offline
Send a message via ICQ to Mind
sambro
Member
Join Date: May 2005
Old 05-15-2005 , 10:55  
Reply With Quote #7

I see what you mean. cl_rate isn't working either. For some reason name does though.
sambro is offline
Send a message via MSN to sambro
lucieh
New Member
Join Date: May 2005
Old 05-21-2005 , 07:02  
Reply With Quote #8

Valve removed this feature. But it works for some cvars. If this feature worked I would force some cvars to stop cheating. Hlguard isn't hack proof. So you can't force some hack client cvars to be default settings.
lucieh is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:43.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode