Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp> //default include
- #include <sscanf2> //sscanf(params,...);
- #include <zcmd> //for /checkhh
- #define COLOR_RED 0xFF0000FF //color used in messages
- #define Admin IsPlayerAdmin //change to your Admin script
- #define NewHealthTime 1000 //change if you dont want to check new health after 1 second
- #define TakenHealthTime 1000 //change if you dont want to check taken health after 1 second
- #define BanHackerTime 1000 //change if you dont want to ban hacker after 1 second
- #define BanDialog 0 //number of dialog
- #define BanPlayer false //"true" -> it will ban player if he/she has HH | "false" -> it will send message to admin that player might be HHacking
- #define Website sampcss //shown in dialog after player banned -> show him/her where to request unban
- new target; //player that you are checking
- new admin; //admin that is performing cmd
- forward CheckNewHealth(); //check health after fall
- forward CheckTakenHealth(); //check if target took any damage
- forward BanIfHacker(); //finally, checks if target did not lose any health, in other words -> bans hacker
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- }
- #endif
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- COMMAND:checkhh(playerid, params[])
- {
- if(!Admin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be logged in as an RCON administrator to perform this!");
- if(sscanf(params, "u", target)) return SendClientMessage(admin, COLOR_RED, "Correct usage -> /checkhh <playerid>");
- if(!IsPlayerConnected(target)) return SendClientMessage(admin, COLOR_RED, "ERROR: Player was not found!");
- new Float:X;
- new Float:Y;
- new Float:Z;
- GetPlayerPos(target,X,Y,Z);
- SetPlayerPos(target,X,Y,Z+15);
- SetTimer("CheckTakenHealth",TakenHealthTime,false);
- return 1;
- }
- public CheckTakenHealth()
- {
- new Float:CurrHealth;
- GetPlayerHealth(target,CurrHealth);
- SetPVarFloat(target,"CurrHealth",CurrHealth);
- SetTimer("CheckNewHealth",NewHealthTime,false);
- }
- public CheckNewHealth()
- {
- new Float:NewHealth;
- GetPlayerHealth(target,NewHealth);
- SetPVarFloat(target,"NewHealth",NewHealth);
- SetTimer("BanIfHacker",BanHackerTime,false);
- }
- public BanIfHacker()
- {
- #if BanPlayer == true
- if(GetPVarFloat(target,"CurrHealth") == GetPVarFloat(target,"NewHealth"))
- {
- new pname[MAX_PLAYER_NAME];
- new string[256];
- GetPlayerName(target,pname,sizeof(pname));
- format(string,sizeof(string),"[ANTI-CHEAT]: %s has been banned for Health Hacks!",pname);
- SendClientMessageToAll(COLOR_RED,string);
- new baninfo[256];
- format(baninfo,sizeof(baninfo),"You have been banned for Health hacking!\n\nWanna get unbanned? Post at www."#Website#".com!");
- ShowPlayerDialog(target,BanDialog,DIALOG_STYLE_MSGBOX,"BANNED!", baninfo,"OK","");
- BanEx(target,"Health Hack");
- }
- #endif
- #if BanPlayer == false
- if(GetPVarFloat(target,"CurrHealth") == GetPVarFloat(target,"NewHealth"))
- {
- new pname[MAX_PLAYER_NAME];
- new string[256];
- GetPlayerName(target,pname,sizeof(pname));
- format(string,sizeof(string),"%s is possible Health Hacker!",pname);
- SendClientMessage(admin,COLOR_RED,string);
- }
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement