AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Zero (0) HP Bug Fix by Exolent (https://forums.alliedmods.net/showthread.php?t=68124)

travo 03-10-2008 04:46

Re: Zero (0) HP Bug Fix
 
if its > than 255 its unreadable anyways, so why not do
PHP Code:

if (hp>255)
{
    
message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("Health"),_,id);
    
write_byte(255);
    
message_end();



hleV 03-10-2008 06:05

Re: Zero (0) HP Bug Fix
 
Nice, gonna use it for ZombieMod server.

vittu 03-11-2008 04:10

Re: Zero (0) HP Bug Fix
 
Quote:

Originally Posted by travo (Post 595126)
if its > than 255 its unreadable anyways, so why not do

for travo, done properly:
Code:

public message_Health(msgid, dest, id)
{
        if(!is_user_alive(id))
                return PLUGIN_CONTINUE;

        if(get_msg_arg_int(1) > 255)
        {
                set_msg_arg_int(1, ARG_BYTE, 255);
        }
        return PLUGIN_CONTINUE;
}


ConnorMcLeod 03-11-2008 05:16

Re: Zero (0) HP Bug Fix
 
Quote:

Originally Posted by vittu (Post 595525)
Code:

public message_Health(msgid, dest, id)
{
        if(!is_user_alive(id))
                return PLUGIN_CONTINUE;

        static hp;
        hp = get_msg_arg_int(1);

        if(hp > 255)
        {
                set_msg_arg_int(1, ARG_BYTE, 255);
        }
        return PLUGIN_CONTINUE;
}


This should be added in the plugin !!

Exolent[jNr] 03-11-2008 07:37

Re: Zero (0) HP Bug Fix
 
@vittu
ill do some testing to see if i can reduce coding
i just like to test myself so i know for sure it will fix the bug

SchlumPF* 03-12-2008 22:23

Re: Zero (0) HP Bug Fix
 
this was made a while ago by fatalis (posted on xtreme-jumps.eu) but nice to see it here too :P

vittu 03-12-2008 23:49

Re: Zero (0) HP Bug Fix
 
Quote:

Originally Posted by SchlumPF* (Post 596277)
this was made a while ago by fatalis (posted on xtreme-jumps.eu) but nice to see it here too :P

Really cause I just took a look and could not find anything there.


------------------
travo, updated that code above. Didn't need the hp variable for what you wanted to do.

Exolent[jNr] 03-13-2008 07:29

Re: Zero (0) HP Bug Fix
 
ive never seen a plugin like this...

Alka 03-13-2008 11:09

Re: Zero (0) HP Bug Fix
 
Quote:

Originally Posted by X-olent (Post 596343)
ive never seen a plugin like this...

Code:

#include <amxmodx>
#include <fun>
 
#define PLUGIN "New Plugin"
#define VERSION "0.1"
#define AUTHOR "Fatalis"
 
public plugin_init()
{
 register_plugin(PLUGIN, VERSION, AUTHOR)
 
 register_event("Damage", "msgDamage", "be", "2!0");
 
 return PLUGIN_CONTINUE;
}
 
public msgDamage(id)
{
 new health = get_user_health(id);
 if(health > 255 && !(health%256))
 {
  set_user_health(id, health-1);
 
  client_print(id, print_chat, "[XJ] 0 HP bug prevented.");
 }
 
 return PLUGIN_CONTINUE;
}


vittu 03-13-2008 15:17

Re: Zero (0) HP Bug Fix
 
Well this method is still superior since that one only catches the damage event. Health can be changed in other ways not involving damage. This plugin's method is also better for its use of register_message rather than register_event. I also would rather not change the users health and just send the message to change their hud only, which I showed above.


All times are GMT -4. The time now is 08:34.

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