- Код:
/*
Webhk - Anti-Cheat 1.0
by CeZaR
*/
#include <a_samp>
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFFF
new ammos[MAX_PLAYERS];
new deaths[MAX_PLAYERS];
new fires[MAX_PLAYERS];
new kills[MAX_PLAYERS];
new moneys[MAX_PLAYERS];
new waiting[MAX_PLAYERS];
new weapons[MAX_PLAYERS];
new Float:position_x[MAX_PLAYERS];
new Float:position_y[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
moneys[playerid] = 50000;
waiting[playerid] = false;
return 1;
}
public OnPlayerUpdate(playerid)
{
new keys, updown, leftright;
GetPlayerKeys(playerid, keys, updown, leftright);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
new Float:health;
GetPlayerHealth(playerid, health);
if(playerid != -1){
if(position_x[playerid] != x || position_y[playerid] != y){
if(keys != 0 || updown != 0 || leftright != 0 || IsPlayerInAnyVehicle(playerid)){
waiting[playerid] = false;
}
}
else{
waiting[playerid] = true;
}
if(waiting[playerid]){
new Float:temp_x = position_x[playerid] - x;
new Float:temp_y = position_y[playerid] - y;
if(temp_x < 0){
temp_x = temp_x * -1;
}
if(temp_y < 0){
temp_y = temp_y * -1;
}
if(temp_x > 0.1 || temp_y > 0.1){
if(temp_x < 10 && temp_y < 10){
SetPlayerHealth(playerid, health - 5);
}
}
}
}
position_x[playerid] = x;
position_y[playerid] = y;
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(moneys[playerid] + 100 < GetPlayerMoney(playerid)){
new message[256];
GetPlayerName(playerid, message, sizeof(message));
strcat(message, " has been kicked. - Money Cheating");
SendClientMessageToAll(0xFFFF00AA, message);
Kick(playerid);
}
if(oldkeys & KEY_FIRE){
if(GetPlayerAmmo(playerid) != 65535){
if(fires[playerid] == 0){
weapons[playerid] = GetPlayerWeapon(playerid);
ammos[playerid] = GetPlayerAmmo(playerid);
}
fires[playerid]++;
if(fires[playerid] > 10){
if(weapons[playerid] == GetPlayerWeapon(playerid) && ammos[playerid] == GetPlayerAmmo(playerid)){
new message[256];
GetPlayerName(playerid, message, sizeof(message));
strcat(message, " has been kicked. - Ammo Cheating");
SendClientMessageToAll(0xFFFF00AA, message);
Kick(playerid);
}
fires[playerid] = 0;
}
if(weapons[playerid] != GetPlayerWeapon(playerid)){
fires[playerid] = 0;
}
}
}
}
public OnPlayerDeath(playerid, killerid, reason)
{
kills[killerid]++;
deaths[playerid]++;
new playercash;
playercash = GetPlayerMoney(playerid);
if(playercash > 0){
moneys[killerid] = GetPlayerMoney(killerid) + playercash;
}
return 1;
}