kiril94,
Вариант № 1:
В начало:
Code
new bool:CarFixAC[MAX_PLAYERS];
В Античит:
Code
// Vehicle health
if(!CarFixAC[playerid]){
if(vHealth > 0){
if(vHealth > 990){
if(playerCheatTreshold[playerid] > 30){
AdminMessage("The player who is being kicked had their vehicle health go beyond our limit..");
BanReason(playerid, "Server", "Anti-Cheat triggered (Code: 101)");
printf("CHEAT - VHEALTH1 - %s - %f", playerName[playerid], vHealth);
return false;
} else {
playerCheatTreshold[playerid]++;
}
}
if(vHealth > playerVehicleHealth[playerid] && playerVehicleHealth[playerid] > 0){
AdminMessage("The player who is being kicked had their vehicle health go up..");
BanReason(playerid, "Server", "Anti-Cheat triggered (Code: 102)");
printf("CHEAT - VHEALTH2 - %s - %f %f", playerName[playerid], vHealth, playerVehicleHealth[playerid]);
return false;
}
}
GetVehicleHealth(GetPlayerVehicleID(playerid), playerVehicleHealth[playerid]);
}
}
В команду Fix:
Code
dcmd_fix(playerid, params[]){
#pragma unused params
new string [128];
if(PlayerInfo[playerid][pCash] < 3){
format(string, sizeof(string), "[Error] Need 3 coins, your coins %d only",PlayerInfo[playerid][pCash]);
SendClientMessage(playerid, COLOR_RED, string);
} else {
CarFixAC[playerid] = true;
RepairVehicle(GetPlayerVehicleID(playerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, " Your car was fixed, and -3 coins, try again");
PlayerInfo[playerid][pCash] = -3;
}
}
В public OnPlayerConnect(playerid):
Code
CarFixAC[playerid] = false;
В public OnPlayerDisconnect(playerid):
Code
CarFixAC[playerid] = false;
Этот вариант не безопасен так как после починки авто античит больше не будет проверять машину игрока на использование чита.
Вариант № 2:
В команду Fix:
Code
dcmd_fix(playerid, params[]){
#pragma unused params
new string [128];
if(PlayerInfo[playerid][pCash] < 3){
format(string, sizeof(string), "[Error] Need 3 coins, your coins %d only",PlayerInfo[playerid][pCash]);
SendClientMessage(playerid, COLOR_RED, string);
} else {
RepairVehicle(GetPlayerVehicleID(playerid));
SetVehicleHealth(GetPlayerVehicleID(playerid),989.0);
SendClientMessage(playerid, COLOR_LIGHTBLUE, " Your car was fixed, and -3 coins, try again");
PlayerInfo[playerid][pCash] = -3;
}
}