Raised This Month: $10 Target: $400
 2% 

Solved Gravity (set_user_gravity)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
llaj
Junior Member
Join Date: Jul 2016
Old 08-21-2021 , 21:21   Gravity (set_user_gravity)
Reply With Quote #1

Hello.
I found here this plugin but i have bit problem. Im also using "respawn forever" plugin and this gravity plugin isnt work good with it. When player is respawned, gravity is changed back to default. Can someone help me and fix it? I want it like when i change gravity by command, gravity will not change back to default after every respawn, but it will last until the end of the map. Thank you guys!

PHP Code:
#include <amxmodx>
#include <fun>

#define NORMAL_GRAVITY 1.0
#define LOW_GRAVITY 0.5

new bool:gravity[33];

public 
plugin_init()
    
register_clcmd("say /gravity""clcmd_g");

public 
clcmd_g(id)
{
    if(
gravity[id]){
        
set_user_gravity(idNORMAL_GRAVITY);
        
gravity[id] = false;
    }

    else {
        
set_user_gravity(idLOW_GRAVITY);
        
gravity[id] = true;
    }


Last edited by llaj; 08-21-2021 at 23:00.
llaj is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-21-2021 , 22:34   Re: Gravity (set_user_gravity)
Reply With Quote #2

Not tested
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fun>

#define NORMAL_GRAVITY 1.0
#define LOW_GRAVITY 0.5

new bool:gravity[33];

public 
plugin_init()
{
    
register_clcmd("say /gravity""clcmd_g");
    
RegisterHamHam_Spawn "player" "HamSpawn_Post" true );
}

public 
clcmd_gid )
{
    if(
gravity[id])
    {
        
set_user_gravity(idNORMAL_GRAVITY);
        
gravity[id] = false;
    }
    
    else 
    {
        
set_user_gravity(idLOW_GRAVITY);
        
gravity[id] = true;
    }


public 
HamSpawn_PostiPlayer )
{
    if ( 
gravity[iPlayer] && is_user_aliveiPlayer ) )
        
set_user_gravity(iPlayerLOW_GRAVITY);

__________________

Last edited by Bugsy; 08-22-2021 at 12:36.
Bugsy is offline
llaj
Junior Member
Join Date: Jul 2016
Old 08-21-2021 , 22:59   Re: Gravity (set_user_gravity)
Reply With Quote #3

Thank you! Works great.
llaj is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 08-22-2021 , 07:08   Re: Gravity (set_user_gravity)
Reply With Quote #4

PHP Code:
    if(gravity[id])
    {
        
set_user_gravity(idNORMAL_GRAVITY);
        
gravity[id] = false;
    }
    
    else 
    {
        
set_user_gravity(idLOW_GRAVITY);
        
gravity[id] = true;
    } 



PHP Code:
set_user_gravityid, ( gravity[id] = !gravity[id] ) ? LOW_GRAVITY:NORMAL_GRAVITY ); 
__________________
@Jailbreak Main Mod v2.6.6 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 08-22-2021 at 07:12.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Old 08-22-2021, 08:01
Shadows Adi
This message has been deleted by Shadows Adi. Reason: nvrm
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-22-2021 , 08:33   Re: Gravity (set_user_gravity)
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
PHP Code:
    if(gravity[id])
    {
        
set_user_gravity(idNORMAL_GRAVITY);
        
gravity[id] = false;
    }
    
    else 
    {
        
set_user_gravity(idLOW_GRAVITY);
        
gravity[id] = true;
    } 


PHP Code:
set_user_gravityid, ( gravity[id] = !gravity[id] ) ? LOW_GRAVITY:NORMAL_GRAVITY ); 
I actually prefer the original version, easier to read. One-liners are generally trouble.
__________________
HamletEagle 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 02:38.


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