Raised This Month: $ Target: $400
 0% 

return gravity trough a native


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 04-21-2011 , 14:39   return gravity trough a native
Reply With Quote #1

so i have the following code...
my problem is that the return is always 0.0
what have i done wrong?
PHP Code:
public plugin_natives()
    
register_native("zpnm_get_user_gravity""native_get_user_gravity"1)

// Native: zpnm_get_user_gravity
public Float:native_get_user_gravity(id)
{
    
// ZP disabled
    
if (!g_pluginenabled)
        return -
1.0;
    
    if (!
is_user_valid_alive(id))
        return 
0.0;
/*=====    
    if (g_nemesis[id] || g_survivor[id] || g_sniper[id])
        return Float:pev(id, pev_gravity) * get_cvar_float("sv_gravity");
    else if (g_zombie[id])
        return Float:ArrayGetCell(g_zclass_grav, g_zombieclass[id]) * get_cvar_float("sv_gravity");
    else
        return Float:ArrayGetCell(g_hclass_grav, g_humanclass[id]) * get_cvar_float("sv_gravity");
    
    return 1.0;
=======*/    
    
return Float:pev(idpev_gravity);

in the include file:
PHP Code:
native Float:zpnm_get_user_gravity(id
and the plugin i use to return the values:
PHP Code:
#include <amxmodx>
#include <zombieplaguenm>

public plugin_init()
    
register_clcmd("say info""clcmd_info")

public 
clcmd_info(id)
{
    static 
name[64]
    
zpnm_get_user_class_name(idnamecharsmax(name))
    
    
client_print(idprint_chat"[ZPNM] Class name: %s"name)
    
client_print(idprint_chat"[ZPNM] Class speed: %d"zpnm_get_user_maxspeed(id))
    
client_print(idprint_chat"[ZPNM] Class gravity: %.1f"zpnm_get_user_gravity(id))
    if (
zp_get_user_zombie(id))
        
client_print(idprint_chat"[ZPNM] Class knockback: %.1f"zpnm_get_user_knockback(id))
    
    
zpnm_set_user_maxspeed(id350.0)
    
zpnm_set_user_gravity(id0.5)
    
zpnm_set_user_knockback(id0.5)

__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-21-2011 , 15:07   Re: return gravity trough a native
Reply With Quote #2

You are using pev() wrong.

Code:
new int_value = pev(id, pev_body);

new Float:float_value;
pev(id, pev_maxspeed, float_value);

new string_value[32];
pev(id, pev_classname, string_value, charsmax(string_value));
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 20:11.


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