PDA

View Full Version : Health error


lanix
23/01/2015, 02:15 PM
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;
}

nezo2001
23/01/2015, 02:22 PM
public OnPlayerUpdate(playerid)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(Health > MAX_HEALTH)
{
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);
return 1;
}

Try this

lanix
23/01/2015, 02:27 PM
now when i connect to game get automatic ban

nezo2001
23/01/2015, 02:31 PM
!!!public OnPlayerUpdate(playerid)
{
new Float:Health;
GetPlayerHealth(playerid, 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");
}
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerHealth(playerid, 99);
return 1;
}

lanix
23/01/2015, 02:37 PM
nothing

lanix
23/01/2015, 02:42 PM
automatic ban

Riso135
23/01/2015, 02:44 PM
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...

Saize
23/01/2015, 02:45 PM
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

lanix
23/01/2015, 02:47 PM
can someone show that in codes plz !!!

Riso135
23/01/2015, 02:54 PM
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;
}

Saize
23/01/2015, 02:57 PM
can someone show that in codes plz !!!


God damn dude, Cope and Paste never made a good scripter, its not hard to set a value of hes spawned or not...

lanix
23/01/2015, 03:08 PM
NOT WORKING

Riso135
23/01/2015, 03:14 PM
What is not working on that explain dude lol

lanix
23/01/2015, 03:15 PM
God damn dude, Cope and Paste never made a good scripter, its not hard to set a value of hes spawned or not...
you can see that i am new scripter and i trying to make anicheat

lanix
23/01/2015, 03:18 PM
now working
#include <a_samp>
#include <foreach>

#define WHITE "{FFFFFF}"
#define RED "{F81414}"

#define SetPvarInt(playerid,"Test",1);

#define MAX_HEALTH (98.0)
#define DIALOG_PRAVILA (1000)

public OnFilterScriptInit()
{
return 1;
}

public OnPlayerUpdate(playerid)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(GetPVarInt(playerid,"Test") == 0)
if(Health > 99)
{
TogglePlayerControllable(playerid, false);
SetPlayerPos(playerid, 1941.1534,-1100.2391,-23.7885);
ShowPlayerDialog(playerid, DIALOG_PRAVILA,DIALOG_STYLE_MSGBOX,"Anti-Hack", "{FFCC00}[Anticheat]"WHITE"YOUKikovani ste sa servera\nRazlog kick-a:"RED" Health Hack","Ok","");
BanEx(playerid, "Health Hack");
}
return 1;
}
public OnPlayerConnect(playerid)
{
SetPvarInt(playerid,"Test",1);
SetPlayerHealth(playerid, 98.0);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPvarInt(playerid,"Test",1);
SetPlayerHealth(playerid, 98.0);
return 1;
}

Riso135
23/01/2015, 03:25 PM
Delete those functions from OnPlayerConnect and OnPlayerSpawn, just add them to OnPlayerRequestSpawn (Works)

public OnPlayerRequestSpawn(playerid)
{
SetPVarInt(playerid,"Test",0);
SetPlayerHealth(playerid, 99.0);
return 1;
}

lanix
23/01/2015, 03:31 PM
thanks Riso +rep