getting kicked after player.Health = 100

Started by Kewun, Oct 26, 2016, 02:46 PM

Previous topic - Next topic

Kewun

In linux server, when i try to set someones health to 100, he gets kicked for health hack

"Kicking player ID0 , health increased from 40 to 100"

lol why?

Cool


Kewun

yeah
i use this in my medic function where player with skin 5 when he is close to player when presses x it heals him
heal + kick basically
it happens only sometimes

Mötley

#3
If I seen your heal/health function it would help..

So,, I will pass something by that you could maybe modify into your script as a test.

I think the issue is the player is randomly given health. So try to set in differently

Accounts_Ini <- INI_Open("Accounts.ini");

function SaveAccountFiles() {
 INI_SaveFile( Accounts_Ini, "Accounts.ini");
}

function SetPlayerHealth( name, ammount )
{
        INI_SetInteger( Accounts_Ini, name, "Health", ammount);

        SaveAccountFiles();

        // We do a FindPlayer rather than passing the pointer so values can be set when the player is not ingame
        local plr = FindPlayer( name );
        if ( plr ) plr.Health = ammount;
}
Usage: SetPlayerHealth( plr.Name, 100 );SetPlayerHealth( target.Name, 100 );// For the player you are healing

Kewun

health function
function onHealBind(player)
{
local plr = GetClosestPlayer(player, 40)
if ( !ReadIniBool("stats.ini","logged",player.Name) ) return false;
if ( player.Skin != 5) return false;
if (!plr) {
MessagePlayer("[#ff0000]Too far away from target",player)
return false;
}
if (plr.Health > 99) {
MessagePlayer("[#ff0000]This player's health is 100% or more already",player)
return false;
}
if ( plr.Name == player.Name) {
MessagePlayer("[#ff0000]You cant heal your self!",player)
return false;
}
if (plr.Health < 100) {
local distance = player.Pos.Distance(plr.Pos)
if ( distance < 5 ) {
if ( plr.Vehicle ) plr.Eject();
player.Cash += 2500;
MessagePlayer("[#00ff00]You have been healed by medic..",plr)
Message("[#ffffff]Medic "+player+ " has healed "+plr)
plr.Health = 100
}
else {
MessagePlayer("[#00ff00]You must be near target to heal him",player)
return false;
}
}
}


Mötley

No clue. The only real thing I could suggest is having an actual heal function and not use plr.Health, I think it's tricking the anti-cheat.

SetPlayerHealth( plr.Name, 100 ); // Should do it.
I will leave you up to testing and for someone more use to the linux server

aXXo

Your issue here and this one indicates that your connection to the server has huge packetloss or a lot of jitter.

Both these problems happen with a bad connection. It could be your connection, or the host itself.