AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   error help (https://forums.alliedmods.net/showthread.php?t=223219)

Cigojlo 08-11-2013 04:29

error help
 
i have this eerror in logs, pls anyone help:
L 08/10/2013 - 04:59:37: [FUN] Invalid player 9
L 08/10/2013 - 04:59:37: [AMXX] Displaying debug trace (plugin "zp50_gameplay_fixes.amxx")
L 08/10/2013 - 04:59:37: [AMXX] Run time error 10: native error (native "set_user_health")
L 08/10/2013 - 04:59:37: [AMXX] [0] zp50_gameplay_fixes.sma::message_health (line 448)
L 08/10/2013 - 09:47:10: Start of error session.

PHP Code:

// Fix for the HL engine bug when HP is multiples of 256
public message_health(msg_idmsg_destmsg_entity)
{
    
// Get player's health
    
new health get_msg_arg_int(1)
    
    
// Don't bother
    
if (health 256) return;
    
    
// Check if we need to fix it
    
if (health 256 == 0)
        
set_user_health(msg_entityget_user_health(msg_entity) + 1)
    
    
// HUD can only show as much as 255 hp
    
set_msg_arg_int(1get_msg_argtype(1), 255)


i saw on forum to add is_user_alive to prevent bug can i do this

PHP Code:

// Fix for the HL engine bug when HP is multiples of 256
public message_health(idmsg_idmsg_destmsg_entity)
{
    
// Get player's health
    
new health get_msg_arg_int(1)
    
    
// Don't bother
    
if (health 256) return;
    
    
// Check if we need to fix it
    
if (is_user_alive(id))
    if (
health 256 == 0)
        
set_user_health(msg_entityget_user_health(msg_entity) + 1)
    
    
// HUD can only show as much as 255 hp
    
set_msg_arg_int(1get_msg_argtype(1), 255)



Black Rose 08-11-2013 09:18

Re: error help
 
Yes, that should work.
Just change id to msg_entity


All times are GMT -4. The time now is 15:44.

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