Raised This Month: $ Target: $400
 0% 

HELP - with /gravity for admins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pexu
Junior Member
Join Date: Dec 2011
Old 12-19-2011 , 04:39   HELP - with /gravity for admins
Reply With Quote #1

Hello guys im new on Allied Modders, Im polish and i need help with /gravity for VIP's.

So I'v searched everywhere and I managed to find it but there are a few things I would like to change.

This is what i found, it works fine but it resets in new round, and you need to type it in two times before enableing it.

I need:
-type /gravity or /grav to enable or disable gravity
-Dont want it to reset untill admin types in /gravity or /grav again

Thank you all for your help and time, im sorry if there are some spelling mistakes as i sed im from poland and english is my second language

Here: https://forums.alliedmods.net/showthread.php?p=847780

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

#define MAX_PLAYERS 32

#define ADMIN_LEVEL ADMIN_SLAY
#define ADMIN_GRAV 250.0

new g_bHasGrav[MAX_PLAYERS+1]
new sv_gravity

public plugin_init()
{
    sv_gravity = get_cvar_pointer("sv_gravity")

    register_clcmd("say /grav", "cmdGrav", ADMIN_LEVEL)
    register_clcmd("say /gravity", "cmdGrav", ADMIN_LEVEL)
}

public client_putinserver(id)
{
    g_bHasGrav[id] = false
}

public cmdGrav(id)
{
    if( get_user_flags(id) & ADMIN_LEVEL )
    {
        if( (g_bHasGrav[id] = !g_bHasGrav[id]) )
        {
            set_user_gravity(id, ADMIN_GRAV / get_pcvar_float(sv_gravity))
            client_print(id, print_chat, " * You Have Enabled Low Gravity")
        }
        else
        {
            set_user_gravity(id)
            client_print(id, print_chat, " * You Have Disabled Low Gravity")
        }
    }
    return PLUGIN_HANDLED
} 



Last edited by Pexu; 12-19-2011 at 04:40.
Pexu is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 12-19-2011 , 04:48   Re: HELP - with /gravity for admins
Reply With Quote #2

Gravity is resetted 'cuz the game does automaticly set it back when you spawn.

What you could do is check at spawn if g_bHasGrav at spawn and if "index" does, set it again.
Erox902 is offline
Pexu
Junior Member
Join Date: Dec 2011
Old 12-19-2011 , 04:52   Re: HELP - with /gravity for admins
Reply With Quote #3

Do is there no way i can have gravity at all times untill i type /gravity again ?
Pexu is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-19-2011 , 05:02   Re: HELP - with /gravity for admins
Reply With Quote #4

Did you read what Erox902 said ?

Code:
RegisterHam( Ham_Spawn , "player" , "fwPlayerSpawn" , true ) // hook the spawn with ham public fwPlayerSpawn( id ) // spawn function {     if( g_bHasGrav[ id ] ) // if he's gravity     {         set_user_gravity( ... ) // set it     } }

Btw :

Code:
if( (g_bHasGrav[id] = !g_bHasGrav[id]) )

=

Code:
if( !g_bHasGrav[id] )
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Pexu
Junior Member
Join Date: Dec 2011
Old 12-19-2011 , 05:09   Re: HELP - with /gravity for admins
Reply With Quote #5

This looks like it would work, but i am new to scripting could you show me this added in

Thank your the best karma !!
Pexu is offline
Old 12-19-2011, 06:37
Devil259
This message has been deleted by Devil259. Reason: See code page 2
Pexu
Junior Member
Join Date: Dec 2011
Old 12-19-2011 , 06:56   Re: HELP - with /gravity for admins
Reply With Quote #7

why is it when i coppy and paste it all looks like this:

Code:
#include <amxmodx> #include <fun> #include <hamsandwich> #define MAX_PLAYERS 32 #define ADMIN_LEVEL ADMIN_SLAY #define ADMIN_GRAV 250.0 new g_bHasGrav[MAX_PLAYERS+1] new sv_gravity public plugin_init() {     sv_gravity = get_cvar_pointer("sv_gravity")     register_clcmd("say /grav", "cmdGrav", ADMIN_LEVEL)     register_clcmd("say /gravity", "cmdGrav", ADMIN_LEVEL)     RegisterHam( Ham_Spawn , "player" , "fwPlayerSpawn" , true ) } public fwPlayerSpawn( id ) {     if( is_user_alive( id ) && g_bHasGrav[ id ] )     {         set_user_gravity( id , ADMIN_GRAV / get_pcvar_float(sv_gravity))     } } public client_putinserver(id) {     g_bHasGrav[id] = false } public cmdGrav(id) {     if( get_user_flags(id) & ADMIN_LEVEL )     {         if( !g_bHasGrav[id] )         {             set_user_gravity(id, ADMIN_GRAV / get_pcvar_float(sv_gravity))             client_print(id, print_chat, " * You Have Enabled Low Gravity")         }         else         {             set_user_gravity(id)             client_print(id, print_chat, " * You Have Disabled Low Gravity")         }     }     return PLUGIN_HANDLED }
Pexu is offline
Pexu
Junior Member
Join Date: Dec 2011
Old 12-19-2011 , 07:06   Re: HELP - with /gravity for admins
Reply With Quote #8

I have tried this but gravity still resets in next round ;(

Can some one make a plugin like this when player with flag "t" types in /gravity it sets gravity to lower and when they type /gravityoff it sets it back to normal ?

is it possible so that it does not reset every round ?
Pexu is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 12-19-2011 , 07:28   Re: HELP - with /gravity for admins
Reply With Quote #9

The code that Devil259 should work.
Are you sure that you compiled and replaced the original amxx?

Also don't double post use the edit button
Erox902 is offline
Pexu
Junior Member
Join Date: Dec 2011
Old 12-19-2011 , 07:43   Re: HELP - with /gravity for admins
Reply With Quote #10

yes, after i type /gravity it works but restes in the next round an also when i type in /gravity second time in the round it doesent change back to norman this pops up all the time "
You Have Enabled Low Gravity
Pexu 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 12:06.


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