SA-MP Forums Archive
Health error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Health error (/showthread.php?tid=559462)



Health error - lanix - 23.01.2015

why this not working when i test in game
Код:
#include <a_samp>
#include <foreach>

#define BJELA      "{FFFFFF}"
#define CRVENA     "{F81414}"

#define MAX_HEALTH (99.0)
#define DIALOG_PRAVILA (1000)

public OnFilterScriptInit()
{
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new Float:Health;
    GetPlayerHealth(playerid, Health);
    #if defined MAX_HEALTH
    if(Health > 99.0)
    {
        TogglePlayerControllable(playerid, false);
        SetPlayerPos(playerid, 1941.1534,-1100.2391,-23.7885);
        ShowPlayerDialog(playerid, DIALOG_PRAVILA,DIALOG_STYLE_MSGBOX,"Anti-Hack", "{FFCC00}[Anticheat]"BJELA"YOUKikovani ste sa servera\nRazlog kick-a:"CRVENA" Health Hack","Ok","");
        BanEx(playerid, "Health Hack");
    }
    #endif
    return 1;
}
public OnPlayerSpawn(playerid)
{
        SetPlayerHealth(playerid, 99);
        return 1;
}



Re: Health error - nezo2001 - 23.01.2015

PHP код:
public OnPlayerUpdate(playerid)
{
    new 
Float:Health;
    
GetPlayerHealth(playeridHealth);
    if(
Health MAX_HEALTH)
    {
        
TogglePlayerControllable(playeridfalse);
        
SetPlayerPos(playerid1941.1534,-1100.2391,-23.7885);
        
ShowPlayerDialog(playeridDIALOG_PRAVILA,DIALOG_STYLE_MSGBOX,"Anti-Hack""{FFCC00}[Anticheat]"BJELA"YOUKikovani ste sa servera\nRazlog kick-a:"CRVENA" Health Hack","Ok","");
        
BanEx(playerid"Health Hack");
    }
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
        
SetPlayerHealth(playerid99);
        return 
1;

Try this


Re: Health error - lanix - 23.01.2015

now when i connect to game get automatic ban


Re: Health error - nezo2001 - 23.01.2015

!!!
PHP код:
public OnPlayerUpdate(playerid

    new 
Float:Health
    
GetPlayerHealth(playeridHealth); 
    if(
Health 99.0
    { 
        
TogglePlayerControllable(playeridfalse); 
        
SetPlayerPos(playerid1941.1534,-1100.2391,-23.7885); 
        
ShowPlayerDialog(playeridDIALOG_PRAVILA,DIALOG_STYLE_MSGBOX,"Anti-Hack""{FFCC00}[Anticheat]"BJELA"YOUKikovani ste sa servera\nRazlog kick-a:"CRVENA" Health Hack","Ok",""); 
        
BanEx(playerid"Health Hack"); 
    } 
    return 
1

public 
OnPlayerSpawn(playerid

        
SetPlayerHealth(playerid99); 
        return 
1




Re: Health error - lanix - 23.01.2015

nothing


Re: Health error - lanix - 23.01.2015

automatic ban


Re: Health error - Riso135 - 23.01.2015

then make SetPVarInt for onplayerconnect with value 1. when firstly spawned set SetPVarInt value to 0
and then in that script add if(GetPVarInt... == 0) blah blah BanEx...


AW: Health error - Saize - 23.01.2015

Probably because your health getting set to 100 by default when you connect.

Set the HP to 100 or let the AC only check spawned players


Re: Health error - lanix - 23.01.2015

can someone show that in codes plz !!!


Re: Health error - Riso135 - 23.01.2015

OnPlayerConnect:
Код:
SetPvarInt(playerid,"Test",1);
when firstly spawned add to line:
Код:
SetPvarInt(playerid,"Test",0);
and add condition to your script (GetPVarInt) + EDIT health on spawn
Код:
public OnPlayerUpdate(playerid) 
{ 
    new Float:Health; 
    GetPlayerHealth(playerid, Health);
    if(GetPVarInt(playerid,"Test") == 0)
    {
    if(Health > 99.0) 
    { 
        TogglePlayerControllable(playerid, false); 
        SetPlayerPos(playerid, 1941.1534,-1100.2391,-23.7885); 
        ShowPlayerDialog(playerid, DIALOG_PRAVILA,DIALOG_STYLE_MSGBOX,"Anti-Hack", "{FFCC00}[Anticheat]"BJELA"YOUKikovani ste sa servera\nRazlog kick-a:"CRVENA" Health Hack","Ok",""); 
        BanEx(playerid, "Health Hack"); 
    }
    }
    return 1; 
}
Код:
public OnPlayerSpawn(playerid) 
{ 
        SetPlayerHealth(playerid, 99.0); 
        return 1; 
}