AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_user_gravity (https://forums.alliedmods.net/showthread.php?t=45273)

stigma 09-27-2006 15:37

set_user_gravity
 
public mBoots(id) {
if (mBoot[id] > 0) {
new uGrav = get_user_gravity(id)
set_user_gravity(id,uGrav+(mBoot[id]*20))
}
return PLUGIN_CONTINUE
}

And the mBoot is in the top as "mBoot[33] = 1"

Silencer123 09-27-2006 15:51

Re: set_user_gravity
 
First, please put your code in [small]-Tag and indent it:
Code:
public mBoots(id) {     if (mBoot[id]>0)     {         new uGrav=get_user_gravity(id)         set_user_gravity(id,uGrav+(mBoot[id]*20))     }     return PLUGIN_CONTINUE }
Then, tell us what is your Problem!
I guess it tells you, that there is a Tag-Mismatch.
Instead of
Code:
new uGrav = get_user_gravity(id)
use
Code:
new Float:uGrav = get_user_gravity(id)
Also:
20 is an Integer, not a Float (Use: 20.0).
Also, this would increase the Players Gravity insanely high, not lower it.
Note, that get_user_gravity(id) and set_user_gravity does not work like
sv_gravity in Game. (Where 800 is normal Gravity) Here 1.0 is equal to 800 in Game
while 0.0 is equal to 0 in Game.

stigma 09-27-2006 15:59

Re: set_user_gravity
 
Thanks duude

++karma

stigma 09-27-2006 16:05

Re: set_user_gravity
 
Well i've done this instead..

Code:
public mBoots(id) {     if (mBoot[id] = 1) { //line 98         set_user_gravity(id,0.9)     } else if (mBoot[id] = 2) { // line 100         set_user_gravity(id,0.7)     } else if (mBoot[id] = 3) { //line 102         set_user_gravity(id,0.4)     }     return PLUGIN_CONTINUE }

But now i get 3 warnings:

Warning: Possibly unintended assignment on line 98
Warning: Possibly unintended assignment on line 100
Warning: Possibly unintended assignment on line 102

jRaven 09-27-2006 16:11

Re: set_user_gravity
 
Code:

new var = 42
if (var == 1) { //if var is equal to the number 1
    do_stuff()
}


stigma 09-27-2006 16:14

Re: set_user_gravity
 
Well i know that, jRaven.

Greenberet 09-27-2006 16:23

Re: set_user_gravity
 
stigma

you are using "=" instead of "=="


All times are GMT -4. The time now is 04:46.

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