Health error
#1

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;
}
Reply
#2

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
Reply
#3

now when i connect to game get automatic ban
Reply
#4

!!!
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

Reply
#5

nothing
Reply
#6

automatic ban
Reply
#7

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...
Reply
#8

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
Reply
#9

can someone show that in codes plz !!!
Reply
#10

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; 
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)