AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   return gravity trough a native (https://forums.alliedmods.net/showthread.php?t=155406)

georgik57 04-21-2011 14:39

return gravity trough a native
 
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)



Exolent[jNr] 04-21-2011 15:07

Re: return gravity trough a native
 
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));



All times are GMT -4. The time now is 20:11.

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