Raised This Month: $ Target: $400
 0% 

Help / Support Percent speed and gravity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Killer zm
Senior Member
Join Date: Jun 2011
Old 09-30-2013 , 08:57   Percent speed and gravity
Reply With Quote #1

How to get 10% from max speed ? and gravity I want to increase the maxspeed with + 10% from max speed

I tried like this

new Float:current_speed
pev(id, pev_maxspeed, current_speed)

new Float:newspeed = 10.0 * current_speed / 100.0

but when

set_pev(id, pev_maxspeed, float(maxspeed))

It give more speed then should give ...and is the same with gravity what is wrong ? with my code ?
Killer zm is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 09-30-2013 , 11:11   Re: Percent speed and gravity
Reply With Quote #2

==========>

PHP Code:
set_pev(idpev_maxspeedcurrent_speed newspeed
__________________
You will find everything u need :-

Last edited by Catastrophe; 10-01-2013 at 01:26.
Catastrophe is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-30-2013 , 11:20   Re: Percent speed and gravity
Reply With Quote #3

.1 * any number is 10% of that number.

10 * .1 = 1

100 * .1 = 10

And so on

Currentspeed * 1.1 = 10 percent increase of speed

As for gravity. I've one used a multiplier from fun module. 1.1 should be a 10 percent increase of gravity. 0.9 should be 90% of the server var or 10% less gravity
Doc-Holiday is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 09-30-2013 , 12:42   Re: Percent speed and gravity
Reply With Quote #4

I tried and I think I dont understand can you show mw an code example please ?
Killer zm is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-30-2013 , 14:01   Re: Re: Percent speed and gravity
Reply With Quote #5

Quote:
Originally Posted by Killer zm View Post
I tried and I think I dont understand can you show mw an code example please ?
Show what you tried the code not psudocode.

So I can explain your problems. Your above example wouldn't do anything because the variable doesn't exist in that example.
Doc-Holiday is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 09-30-2013 , 14:05   Re: Percent speed and gravity
Reply With Quote #6

I fixed.... the problem was not there here is my code and is working now

new Float:current_maxspeed
pev(id, pev_maxspeed, current_maxspeed)

set_pev(id, pev_maxspeed, current_maxspeed + 20 * current_maxspeed / 100 )

the same with gravity but instead + there is -

my code was reapating to much time and that was why i was getting there to much speed thank you any way
Killer zm is offline
Catastrophe
Veteran Member
Join Date: Jul 2012
Location: somewhere between narnia
Old 10-01-2013 , 01:25   Re: Percent speed and gravity
Reply With Quote #7

Isnt this what i just said ? read post 2 -_-
__________________
You will find everything u need :-
Catastrophe is offline
Killer zm
Senior Member
Join Date: Jun 2011
Old 10-01-2013 , 02:32   Re: Percent speed and gravity
Reply With Quote #8

yes but I was already do that before you post I just forget to post in the code maxspeed was an current + new ... and the problem was because that public was repet for many times so I stopped for once repet ...
Killer zm 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 20:11.


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