Raised This Month: $ Target: $400
 0% 

(native "set_user_health") error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OM NOM NOM NOM
Member
Join Date: Jan 2010
Old 02-05-2010 , 01:00   (native "set_user_health") error
Reply With Quote #1

Everything seems to work just fine, yet my logs say otherwise.

L 01/11/2010 - 12:23:58: [AMXX] Run time error 10 (plugin "om33h.amxx") (native "set_user_health") - debug not enabled!

What did I miss?

PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>
#define Plugin "om33h"
#define Version "1.2"
#define Author "om"
#define ADMIN_LEVEL ADMIN_LEVEL_A
new cvarhp
public plugin_init()
{
register_plugin(PluginVersionAuthor)
RegisterHam(Ham_Spawn"player""client_spawn"1)
cvar register_cvar("hp_enable""1")
hp register_cvar("hp_extra""100")
}
public 
client_spawn(id)
{
if(
get_pcvar_num(cvar) < 1)
return 
PLUGIN_CONTINUE
if(get_user_flags(id) & ADMIN_LEVEL)
set_user_health(idget_user_health(id) + get_pcvar_num(hp))
return 
PLUGIN_CONTINUE

OM NOM NOM NOM is offline
Firippu
Senior Member
Join Date: Jan 2007
Old 02-05-2010 , 01:30   Re: (native "set_user_health") error
Reply With Quote #2

It's giving the 'Invalid player' warning. Everything looks fine to me. A quick fix would be checking if the player is alive before set_user_health takes place.
__________________
Firippu is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-05-2010 , 02:21   Re: (native "set_user_health") error
Reply With Quote #3

In client_spawn check first if the client is alive.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
OM NOM NOM NOM
Member
Join Date: Jan 2010
Old 02-05-2010 , 03:47   Re: (native "set_user_health") error
Reply With Quote #4

Thanks, going to try it in a moment.
OM NOM NOM NOM is offline
OM NOM NOM NOM
Member
Join Date: Jan 2010
Old 02-05-2010 , 04:58   Re: (native "set_user_health") error
Reply With Quote #5

PHP Code:
#include < amxmodx >
#include < fun >
#include < hamsandwich >
#define ADMINS_ONLY
#define ADMIN_LEVEL ADMIN_LEVEL_A
new const Version[ ] = "1.3"
new cvarhp
public plugin_init( )
{
register_plugin("Premium health pack"Version"om");
RegisterHamHam_Spawn"player""HamPlayerSpawnPost");
 
cvar register_cvar"hp_enable""1" );
hp register_cvar"hp_extra""25" );
}
 
public 
HamPlayerSpawnPostid )
{
if( 
get_pcvar_numcvar ) ) 
{
if( 
is_user_aliveid ) ) {
#if defined ADMINS_ONLY
if ( !(get_user_flagsid ) & ADMIN_LEVEL ) )
return 
PLUGIN_HANDLED;
#endif 
set_user_healthidget_user_healthid ) + get_pcvar_numhp ) );
}
}
return 
PLUGIN_CONTINUE;

OM NOM NOM NOM is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-05-2010 , 05:58   Re: (native "set_user_health") error
Reply With Quote #6

You can do directly :

Code:
public HamPlayerSpawnPost( id ) {     if ( get_pcvar_num( cvar ) && is_user_alive( id ) )     {         #if defined ADMINS_ONLY         if ( !(get_user_flags( id ) & ADMIN_LEVEL ) )             return PLUGIN_HANDLED;         #endif                 set_user_health( id, get_user_health( id ) + get_pcvar_num( hp ) );     }     return PLUGIN_CONTINUE; }
__________________
Arkshine 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 07:19.


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