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>", -1, false);
g_iMaxPlayers = get_maxplayers();
}
public grvCmd(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new szName[MAX_NAME_LENGTH];
read_args(szName, charsmax(szName));
new iTarget = cmd_target(id, szName, 4);
if(iTarget && IsValid(iTarget) && is_user_connected(iTarget))
{
get_user_name(iTarget, szName, charsmax(szName))
if(!is_user_alive(iTarget))
{
client_print(id, print_console, "[GRAVITY] Player %s is not alive", szName);
return PLUGIN_HANDLED;
}
client_print(id, print_console, "[GRAVITY] Player %s has %i gravity", szName, get_user_gravity(iTarget));
}
else client_print(id, print_console, "[GRAVITY] Player does not exists or it's not connected");
return PLUGIN_HANDLED
}