Raised This Month: $ Target: $400
 0% 

CS Gravity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 08-08-2010 , 02:16   Re: CS Gravity
Reply With Quote #1

Quote:
Originally Posted by hornet View Post
I'm making a level up system which involves my player's gravity going up by 10 (CS gravity) each time the player levels up, in order to allow them to jump higher. My problem is when I use the Fun Module function get_user_gravity(id) it gives me the number 1065353216.

So I looked at it this way - in CS the default gravity is 800. I want it to go up by 10. So 800 divided by 10 is 80, meaning that my gravity goes up by one 80th of the default gravity each level up. So I thought if I get one 80th of 1065353216, which is 13316915, I can increase 1065353216 (the default) by 13316915 (the 80th of the default) each time the player levels up. Now when using set_user_gravity(id) it seems to push you in the opposite way to CS gravity, (at the moment I've only tested this part at level 20) so whether I add or subtract the 80th it will either shoot me up into the sky or glue me to the ground.

Can someone please help me?
The way set_user_gravity works is:

set_user_gravity( id, 1.0 ) <-- Normal Gravity
set_user_gravity( id, 1.5 ) <-- Higher Gravity
set_user_gravity( id, 0.5 ) <-- Lower Gravity

Now, I'm not sure, but you can probably use..

set_user_gravity( id, 0.99 )
set_user_gravity( id, 0.98 )

etc.. but I haven't tested it.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-08-2010 , 03:23   Re: CS Gravity
Reply With Quote #2

Nah both of those didnt work
hornet is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-08-2010 , 04:35   Re: CS Gravity
Reply With Quote #3

Quote:
Originally Posted by hornet View Post
Nah both of those didnt work
It returns those huge values because you are using integers instead of floats.
Try this:
PHP Code:
new Float:xy;
get_user_gravity(id);
get_user_gravity(id);
client_print(idprint_chat"CORRECT %f FALSE %d"xy); 
You will see that CORRECT gravity will return 1.0 or 1.5 or 0.5 depending on the settings that have been made by you or other plugins.
Also you need to set the gravity using float values not integers.
PHP Code:
new Float:1.01;
set_user_gravity(idx);
set_user_gravity(idy); // Here you will get an error ;) 
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-08-2010 , 05:24   Re: CS Gravity
Reply With Quote #4

omg thanks mate you are a champion!!!
hornet is offline
Reply



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 00:18.


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