Raised This Month: $ Target: $400
 0% 

Check Gravity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cirovic
Senior Member
Join Date: Sep 2019
Old 06-20-2022 , 11:04   Check Gravity
Reply With Quote #1

Hello, I need plugin that will show how much player has gravity, for example:

amx_checkgravity Stefan

Player Stefan has 650 gravity

All typed in console, flag L

Last edited by Cirovic; 06-20-2022 at 11:04.
Cirovic is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 06-20-2022 , 11:51   Re: Check Gravity
Reply With Quote #2

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

#define ADMIN_FLAG "l"

#define IsValid(%0) (0 < %0 < g_iMaxPlayers)

#if !defined MAX_NAME_LENGTH
    #define MAX_NAME_LENGTH 33
#endif

new g_iMaxPlayers;

public 
plugin_init()
{
    
register_plugin("Gravity Display""1.0"" ");

    
register_clcmd("amxx_checkgravity""grvCmd"read_flags(ADMIN_FLAG), "<name>", -1false);

    
g_iMaxPlayers get_maxplayers();
}

public 
grvCmd(idlevelcid)
{
    if(!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED

    
new szName[MAX_NAME_LENGTH];
    
read_args(szNamecharsmax(szName));

    new 
iTarget cmd_target(idszName4);

    if(
iTarget && IsValid(iTarget) && is_user_connected(iTarget))
    {
        
get_user_name(iTargetszNamecharsmax(szName))

        if(!
is_user_alive(iTarget))
        {
            
client_print(idprint_console"[GRAVITY] Player %s is not alive"szName);
            return 
PLUGIN_HANDLED;
        }

        
client_print(idprint_console"[GRAVITY] Player %s has %i gravity"szNameget_user_gravity(iTarget));
    }
    else 
client_print(idprint_console"[GRAVITY] Player does not exists or it's not connected");

    return 
PLUGIN_HANDLED


Last edited by lexzor; 06-20-2022 at 11:52.
lexzor is offline
Cirovic
Senior Member
Join Date: Sep 2019
Old 06-20-2022 , 13:16   Re: Check Gravity
Reply With Quote #3

[GRAVITY] Player Stefan has 1055916032 gravity

i should have around 400, its not good.
Cirovic is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-20-2022 , 21:53   Re: Check Gravity
Reply With Quote #4

That's because get_user_gravity() returns a floating point value. Change %i to %f in the client_print() function.
__________________
fysiks is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-21-2022 , 08:43   Re: Check Gravity
Reply With Quote #5

floatround( get_user_gravity(iTarget) * 800.0 )
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 01:34.


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