Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Anticheatsystem by Dark-Trigardon
- * Version: 0.1b
- * Build: 008
- * Date: 23.02.2012
- * Last Edited: Tion
- */
- #include <a_samp>
- // Activate this to use "silent mode", means no message to all clients and let clients crash instand of kicking.
- // Noone will notice the anticheat and it all seems like a big mystery, why all of them crash while cheating :)
- //#define SILENT_MODE
- // Define this if you use it in debug mode
- //#define DEBUG_MODE
- // When you define this, the script will proof more recource-friendlier... But a little bit badder :)
- //#define SAVE_RECOURCES
- /* Set this higher when all players were kicked without reason -> lag-kick-bug */
- #define FREETIME_MONEY 2
- #define FREETIME_HEALTH 4
- #define FREETIME_ARMOUR 4
- #define FREETIME_TELEPORT 4
- #define FREETIME_WEAPON 4
- /* The default dialog-id for the gui, when there a bugs with gui's, change this */
- #define DIALOG_ID 1483
- /* ===================================================================================================================================
- * DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NO
- * T EDIT AFTER HERE DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT
- * AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER
- * HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE • DO NOT EDIT AFTER HERE
- * ===================================================================================================================================
- */
- /*
- * States for each cheat
- */
- #define CHEAT_STATUS_OFF 0 // No action
- #define CHEAT_STATUS_UNDO 1 // Just took him away his money / guns / jetpack / remove from vehicle / ...
- #define CHEAT_STATUS_WARN 2 // Give him a warn, after x warn's -> Kick / Ban
- #define CHEAT_STATUS_KICK 3 // Kick him
- #define CHEAT_STATUS_BAN 4 // Ban him, he can be unbanned in the ACP
- /*
- * Intern dialog-ID's, useless, because it's all in 1 dialog
- */
- #define SUBDIALOG_MAIN 1
- #define SUBDIALOG_CONFIG 2
- #define SUBDIALOG_CONFIG_EDIT 3
- #define SUBDIALOG_CONFIG_EXTENDET 4
- #define SUBDIALOG_BAN 5
- #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- enum apInfo
- {
- bool:apConnected,
- apFreeTime,
- apMoney,
- apSpamMessages,
- Float:apHealth,
- Float:apArmour,
- Float:apPosition[3],
- Float:apAngle,
- apLastSpawned,
- apWeapons[13],
- apAmmo[13],
- apMuted,
- apWarns,
- apSpawnClass,
- apUnkillableTime
- }
- new DTAC_Player[MAX_PLAYERS][apInfo];
- enum acConfig
- {
- money,
- driveby,
- spam,
- armour,
- heal,
- jetpack,
- speed,
- weapon,
- teleport,
- spawnkill,
- quickturn, // 180° turn
- joypad,
- /* extendet config */
- maxwarns,
- bool:savewarns,
- spawnprotecttime
- }
- new DTAC_Config[acConfig];
- enum servSpawnClasses
- {
- team,
- skin,
- Float:spawnx,
- Float:spawny,
- Float:spawnz,
- Float:spawna,
- weapons[3],
- ammo[3]
- }
- new SpawnClasses[300][servSpawnClasses];
- new UpdateTimer;
- public OnFilterScriptInit()
- {
- print("+------------------------------------+");
- print("| Anticheat by Dark-Trigardon.eu |");
- print("+------------------------------------+");
- print(" AC: Initialisiering ...");
- ParseCurrentSettings();
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- // He is connected -> Set his connected-state to "1" and get his money
- DTAC_Player[i][apConnected] = true;
- DTAC_Player[i][apMoney] = GetPlayerMoney(i);
- DTAC_Player[i][apFreeTime] = 3; // 3 seconds, just let the anticheat load all and start then testing :)
- DTAC_Player[i][apSpamMessages] = 0;
- GetPlayerHealth(i, DTAC_Player[i][apHealth]);
- GetPlayerArmour(i, DTAC_Player[i][apArmour]);
- GetPlayerPos(i, DTAC_Player[i][apPosition][0], DTAC_Player[i][apPosition][1], DTAC_Player[i][apPosition][2]);
- GetPlayerFacingAngle(i, DTAC_Player[i][apAngle]);
- DTAC_Player[i][apLastSpawned] = 0;
- DTAC_Player[i][apWarns] = 0;
- DTAC_Player[i][apMuted] = 0;
- }
- }
- UpdateTimer = SetTimer("OnAnticheatUpdate", 1000, true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- print(" AC: Decontermining ...");
- SaveCurrentSettings();
- KillTimer(UpdateTimer);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new playername[MAX_PLAYER_NAME], string[128]; // String wird ein paar mal benutzt, muss deswegen vereinzelt > 128 sein
- GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
- format(string, 128, "DT_Anticheat/%s.ban", playername);
- if(fexist(string))
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- SendClientMessage(playerid, 0xFF0000FF, "DTAC DE: Du bist von diesem Server gebannt.");
- SendClientMessage(playerid, 0xFF0000FF, "DTAC EN: You are banned from this server.");
- SendClientMessage(playerid, 0xFF0000FF, "DTAC FR: Vous etes banni de ce serveur.");
- SendClientMessage(playerid, 0xFF0000FF, "DTAC SP: Usted esta prohibido de este servidor.");
- Kick(playerid);
- #endif
- }
- format(string, 128, "%s connected to the server", playername);
- DTAC_Player[playerid][apConnected] = true;
- DTAC_Player[playerid][apMuted] = 0;
- ResetPlayerMoney(playerid);
- DTAC_Player[playerid][apMoney] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- DTAC_Player[playerid][apConnected] = false;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- // Anti-Teleportbug
- DTAC_Player[playerid][apFreeTime] = FREETIME_TELEPORT;
- // Health
- DTAC_Player[playerid][apUnkillableTime] = DTAC_Config[spawnprotecttime];
- if(DTAC_Config[spawnkill] == CHEAT_STATUS_UNDO)
- DTAC_Player[playerid][apHealth] = 65534.0;
- else
- DTAC_Player[playerid][apHealth] = 100.0;
- SetPlayerHealth(playerid, DTAC_Player[playerid][apHealth]);
- // Weapons
- for(new i = 0; i < 13; i++)
- {
- DTAC_Player[playerid][apWeapons][i] = -1;
- DTAC_Player[playerid][apAmmo][i] = -1;
- }
- // Spawn-Weapons
- _AC_ResetPlayerWeapons(playerid);
- new spawnclass = DTAC_Player[playerid][apSpawnClass];
- for(new i = 0; i < 3; i++)
- {
- new weaponid = SpawnClasses[spawnclass][weapons][i];
- new weaponammo = SpawnClasses[spawnclass][ammo][i];
- new weaponslot = GetWeaponSlot(weaponid);
- if(weaponslot < 0 || weaponslot > 12) continue;
- DTAC_Player[playerid][apWeapons][weaponslot] = weaponid;
- DTAC_Player[playerid][apAmmo][weaponslot] = weaponammo;
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(playerid == killerid) return false;
- /* DriveBy */
- if(DTAC_Config[driveby] > CHEAT_STATUS_OFF)
- {
- new string[128], name[32];
- GetPlayerName(playerid, name, 32);
- if(IsPlayerInAnyVehicle(killerid))
- {
- switch(DTAC_Config[driveby])
- {
- case CHEAT_STATUS_UNDO:
- {
- /* Should we respawn him here ??? */
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "driveby");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due driveby", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due driveby", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- if(DTAC_Player[playerid][apUnkillableTime] >= 1 && DTAC_Config[spawnkill] >= CHEAT_STATUS_OFF)
- {
- new string[128], name[32];
- GetPlayerName(playerid, name, 32);
- switch(DTAC_Config[spawnkill])
- {
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(killerid, 1, "spawn kill");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due spawnkill", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due spawnkill", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/dtac", true) == 0)
- {
- if(!IsPlayerAdmin(playerid)) return false;
- SetPVarInt(playerid, "dtac_dialog", SUBDIALOG_MAIN);
- ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "Anticheat", "Config\nBansystem", "Ok", "Exit");
- return true;
- }
- return 0;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) // SUBDIALOG_CONFIG
- {
- if(dialogid != DIALOG_ID) return false;
- if(!IsPlayerAdmin(playerid)) return false;
- dialogid = GetPVarInt(playerid, "dtac_dialog");
- if(dialogid == SUBDIALOG_MAIN)
- {
- if(!response) return false;
- if(listitem == 0)
- {
- SetPVarInt(playerid, "dtac_dialog", SUBDIALOG_CONFIG);
- ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "Anticheat / Config", "Toogle systemstate\nChange extendet propertys", "Ok", "Exit");
- }
- else if(listitem == 1)
- {
- SetPVarInt(playerid, "dtac_dialog", SUBDIALOG_BAN);
- ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_MSGBOX, "Anticheat / Ban", "Comming soon", "Ok", "Exit");
- }
- }
- else if(dialogid == SUBDIALOG_CONFIG)
- {
- if(!response) return false;
- if(listitem == 0)
- {
- new string[512]; // We need such a big string ;)
- switch(DTAC_Config[money])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "{FFFFFF}Money ( {FF0000}off{FFFFFF} )\n");
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "{FFFFFF}Money ( {00FF00}restore{FFFFFF} )\n");
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "{FFFFFF}Money ( {0000FF}warn{FFFFFF} )\n");
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "{FFFFFF}Money ( {0000FF}kick{FFFFFF} )\n");
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "{FFFFFF}Money ( {0000FF}ban{FFFFFF} )\n");
- }
- default:
- {
- format(string, sizeof(string), "{FFFFFF}Money ( {FF00FF}???{FFFFFF} )\n");
- }
- }
- switch(DTAC_Config[driveby])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Driveby ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Driveby ( {FF0000}ignore{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Driveby ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Driveby ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Driveby ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Driveby ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[spam])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spam ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spam ( {FF0000}mute{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spam ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spam ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spam ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spam ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[heal])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Heal ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Heal ( {00FF00}restore{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Heal ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Heal ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Heal ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Heal ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[armour])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Armour ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Armour ( {00FF00}restore{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Armour ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Armour ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Armour ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Armour ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[jetpack])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Jetpack ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Jetpack ( {00FF00}restore{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Jetpack ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Jetpack ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Jetpack ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Jetpack ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[weapon])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Weapon ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Weapon ( {00FF00}restore{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Weapon ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Weapon ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Weapon ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Weapon ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[spawnkill])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spawnprotection ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spawnprotection ( {00FF00}unkillable{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spawnprotection ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spawnprotection ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spawnprotection ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Spawnprotection ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[quickturn])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Quickturn ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Quickturn ( {00FF00}restore{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Quickturn ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Quickturn ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Quickturn ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Quickturn ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- switch(DTAC_Config[joypad])
- {
- case CHEAT_STATUS_OFF:
- {
- format(string, sizeof(string), "%s{FFFFFF}Joypad ( {FF0000}off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_UNDO:
- {
- format(string, sizeof(string), "%s{FFFFFF}Joypad ( {00FF00}tell him to turn off{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_WARN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Joypad ( {0000FF}warn{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_KICK:
- {
- format(string, sizeof(string), "%s{FFFFFF}Joypad ( {0000FF}kick{FFFFFF} )\n", string);
- }
- case CHEAT_STATUS_BAN:
- {
- format(string, sizeof(string), "%s{FFFFFF}Joypad ( {0000FF}ban{FFFFFF} )\n", string);
- }
- default:
- {
- format(string, sizeof(string), "%s{FFFFFF}Joypad ( {FF00FF}???{FFFFFF} )\n", string);
- }
- }
- SetPVarInt(playerid, "dtac_dialog", SUBDIALOG_CONFIG_EDIT);
- ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "Anticheat / Config / Set Modes", string, "Change", "Exit");
- }
- else if(listitem == 1)
- {
- // Extendet configuration
- SetPVarInt(playerid, "dtac_dialog", SUBDIALOG_CONFIG_EXTENDET);
- new string[150]; // Blame, string is at least 129 chars >.<
- format(string, 128, "{FFFFFF}Max. Warns: {FF0000}%d{FFFFFF}\n", DTAC_Config[maxwarns]);
- if(DTAC_Config[savewarns])
- format(string, 128, "%s{FFFFFF}Save Warns: {FF0000}true{FFFFFF}\n", string);
- else
- format(string, 128, "%s{FFFFFF}Save Warns: {FF0000}false{FFFFFF}\n", string);
- format(string, 128, "%s{FFFFFF}Spawn-Protection time: {FF0000}%d{FFFFFF}", string, DTAC_Config[spawnprotecttime]);
- ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_LIST, "Anticheat / Config / Extendet", string, "Ok", "Exit");
- }
- }
- else if(dialogid == SUBDIALOG_CONFIG_EDIT)
- {
- if(!response) return false;
- switch(listitem)
- {
- case 0:
- {
- DTAC_Config[money]++;
- if(DTAC_Config[money] > 4)
- DTAC_Config[money] = 0;
- }
- case 1:
- {
- DTAC_Config[driveby]++;
- if(DTAC_Config[driveby] > 4)
- DTAC_Config[driveby] = 0;
- }
- case 2:
- {
- DTAC_Config[spam]++;
- if(DTAC_Config[spam] > 4)
- DTAC_Config[spam] = 0;
- }
- case 3:
- {
- DTAC_Config[heal]++;
- if(DTAC_Config[heal] > 4)
- DTAC_Config[heal] = 0;
- }
- case 4:
- {
- DTAC_Config[armour]++;
- if(DTAC_Config[armour] > 4)
- DTAC_Config[armour] = 0;
- }
- case 5:
- {
- DTAC_Config[jetpack]++;
- if(DTAC_Config[jetpack] > 4)
- DTAC_Config[jetpack] = 0;
- }
- case 6:
- {
- DTAC_Config[weapon]++;
- if(DTAC_Config[weapon] > 4)
- DTAC_Config[weapon] = 0;
- }
- case 7:
- {
- DTAC_Config[spawnkill]++;
- if(DTAC_Config[spawnkill] > 4)
- DTAC_Config[spawnkill] = 0;
- }
- case 8:
- {
- DTAC_Config[quickturn]++;
- if(DTAC_Config[quickturn] > 4)
- DTAC_Config[quickturn] = 0;
- }
- case 9:
- {
- DTAC_Config[joypad]++;
- if(DTAC_Config[joypad] > 4)
- DTAC_Config[joypad] = 0;
- }
- }
- // "Bugusing" / show the dialog again
- SetPVarInt(playerid, "dtac_dialog", SUBDIALOG_CONFIG);
- OnDialogResponse(playerid, DIALOG_ID, true, 0, "");
- }
- else if(dialogid == SUBDIALOG_CONFIG_EXTENDET)
- {
- if(!response) return false;
- switch(listitem)
- {
- case 0:
- {
- DTAC_Config[maxwarns]++;
- if(DTAC_Config[maxwarns] > 5)
- DTAC_Config[maxwarns] = 2;
- }
- case 1:
- {
- DTAC_Config[savewarns] = DTAC_Config[savewarns] == false;
- }
- case 2:
- {
- DTAC_Config[spawnprotecttime]++;
- if(DTAC_Config[spawnprotecttime] > 5)
- DTAC_Config[spawnprotecttime] = 0;
- }
- }
- // "Bugusing" / show the dialog again
- SetPVarInt(playerid, "dtac_dialog", SUBDIALOG_CONFIG);
- OnDialogResponse(playerid, DIALOG_ID, true, 1, "");
- }
- else if(dialogid == SUBDIALOG_BAN)
- {
- if(!response) return false;
- }
- return false;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- DTAC_Player[playerid][apSpawnClass] = classid;
- }
- public OnPlayerText(playerid, text[])
- {
- new string[128];
- if(DTAC_Player[playerid][apMuted] >= 1)
- {
- format(string, 128, "You were muted, %d seconds left !", DTAC_Player[playerid][apMuted]);
- SendClientMessage(playerid, 0xFF0000FF, string);
- return false;
- }
- else
- {
- DTAC_Player[playerid][apSpamMessages]++;
- return true;
- }
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- // To read from the config-File
- forward ParseCurrentSettings();
- public ParseCurrentSettings()
- {
- LogText("Load configuration ...");
- new File:configfile;
- new line[128]; // TODO: Set higher if doesn't read config correct
- new ini_key[64], ini_value[64];
- new index;
- ResetConfig();
- configfile = fopen("DT_AntiCheat/config.ini", io_read);
- if(!configfile) return false; // File does not exists
- while(fread(configfile, line) != 0)
- {
- // First, remove the "\r\n"
- line[strlen(line) - 2] = 0;
- // Let's start parsing :)
- index = str_find(line, sizeof(line), '=', 0);
- if(line[0] == 0) continue; // Empty line
- if((line[0] == '#') || (line[0] == '/' && line[1] == '/')) continue; // It's a commented line
- if(index == 0 || index == -1) continue; // No "=" in the line, so that's an invalid line. Go to the next line.
- sub_str(line, ini_key, 0, index);
- sub_str(line, ini_value, index + 1, sizeof(line));
- if(strcmp(ini_key, "money", true) == 0) { LogText(" Loading Money ..."); DTAC_Config[money] = strval(ini_value); }
- if(strcmp(ini_key, "driveby", true) == 0) { LogText(" Loading DriveBy ..."); DTAC_Config[driveby] = strval(ini_value); }
- if(strcmp(ini_key, "spam", true) == 0) { LogText(" Loading Spam ..."); DTAC_Config[spam] = strval(ini_value); }
- if(strcmp(ini_key, "heal", true) == 0) { LogText(" Loading Heal ..."); DTAC_Config[heal] = strval(ini_value); }
- if(strcmp(ini_key, "armour", true) == 0) { LogText(" Loading Armour ..."); DTAC_Config[armour] = strval(ini_value); }
- if(strcmp(ini_key, "jetpack", true) == 0) { LogText(" Loading Jetpack ..."); DTAC_Config[jetpack] = strval(ini_value); }
- if(strcmp(ini_key, "speedhack", true) == 0) { LogText(" Loading Speedhack ..."); DTAC_Config[speed] = strval(ini_value); }
- if(strcmp(ini_key, "weapon", true) == 0) { LogText(" Loading Weapon ..."); DTAC_Config[weapon] = strval(ini_value); }
- if(strcmp(ini_key, "teleport", true) == 0) { LogText(" Loading Teleport ..."); DTAC_Config[teleport] = strval(ini_value); }
- if(strcmp(ini_key, "spawnkill", true) == 0) { LogText(" Loading Spawnkill ..."); DTAC_Config[spawnkill] = strval(ini_value); }
- if(strcmp(ini_key, "quickturn", true) == 0) { LogText(" Loading 180° - Turn ..."); DTAC_Config[quickturn] = strval(ini_value); }
- if(strcmp(ini_key, "maxwarns", true) == 0) { DTAC_Config[maxwarns] = strval(ini_value); }
- if(strcmp(ini_key, "savewarns", true) == 0) { DTAC_Config[savewarns] = strval(ini_value) == 1; }
- if(strcmp(ini_key, "protecttime", true) == 0) { DTAC_Config[spawnprotecttime] = strval(ini_value); }
- }
- fclose(configfile);
- return true;
- }
- forward SaveCurrentSettings();
- public SaveCurrentSettings()
- {
- LogText("Save configuration ...");
- new File:configfile, string[128];
- configfile = fopen("DT_AntiCheat/config.ini", io_write);
- LogText(" Save Money ...");
- format(string, 128, "money=%d\r\n", DTAC_Config[money]); fwrite(configfile, string);
- LogText(" Save DriveBy ...");
- format(string, 128, "driveby=%d\r\n", DTAC_Config[driveby]); fwrite(configfile, string);
- LogText(" Save Spam ...");
- format(string, 128, "spam=%d\r\n", DTAC_Config[spam]); fwrite(configfile, string);
- LogText(" Save Heal ...");
- format(string, 128, "heal=%d\r\n", DTAC_Config[heal]); fwrite(configfile, string);
- LogText(" Save Armour ...");
- format(string, 128, "armour=%d\r\n", DTAC_Config[armour]); fwrite(configfile, string);
- LogText(" Save Jetpack ...");
- format(string, 128, "jetpack=%d\r\n", DTAC_Config[jetpack]); fwrite(configfile, string);
- LogText(" Save Speedhack ...");
- format(string, 128, "speedhack=%d\r\n", DTAC_Config[speed]); fwrite(configfile, string);
- LogText(" Save Weapon ...");
- format(string, 128, "weapon=%d\r\n", DTAC_Config[weapon]); fwrite(configfile, string);
- LogText(" Save Teleport ...");
- format(string, 128, "teleport=%d\r\n", DTAC_Config[teleport]); fwrite(configfile, string);
- LogText(" Save Spawnkill ...");
- format(string, 128, "spawnkill=%d\r\n", DTAC_Config[spawnkill]); fwrite(configfile, string);
- LogText(" Save 180° - Turn ...");
- format(string, 128, "quickturn=%d\r\n", DTAC_Config[quickturn]); fwrite(configfile, string);
- LogText(" Save extendet stuff ...");
- format(string, 128, "maxwarns=%d\r\n", DTAC_Config[maxwarns]); fwrite(configfile, string);
- format(string, 128, "savewarns=%d\r\n", DTAC_Config[savewarns] ? 1 : 0); fwrite(configfile, string);
- format(string, 128, "protecttime=%d\r\n", DTAC_Config[spawnprotecttime]); fwrite(configfile, string);
- fclose(configfile);
- //
- }
- // To set the config to default
- forward ResetConfig();
- public ResetConfig()
- {
- DTAC_Config[money] = CHEAT_STATUS_UNDO;
- DTAC_Config[driveby] = CHEAT_STATUS_WARN;
- DTAC_Config[spam] = CHEAT_STATUS_WARN;
- DTAC_Config[armour] = CHEAT_STATUS_UNDO;
- DTAC_Config[heal] = CHEAT_STATUS_UNDO;
- DTAC_Config[jetpack] = CHEAT_STATUS_KICK;
- DTAC_Config[speed] = CHEAT_STATUS_KICK;
- DTAC_Config[weapon] = CHEAT_STATUS_KICK;
- DTAC_Config[teleport] = CHEAT_STATUS_WARN;
- DTAC_Config[spawnkill] = CHEAT_STATUS_WARN;
- DTAC_Config[quickturn] = CHEAT_STATUS_WARN;
- DTAC_Config[joypad] = CHEAT_STATUS_OFF;
- DTAC_Config[maxwarns] = 3;
- DTAC_Config[savewarns] = false;
- DTAC_Config[spawnprotecttime] = 5; // 5 seconds
- return true;
- }
- // I miss this in SAMP, so hrer it is, "character" = The char to find, "count" = The first char (0) ? The second (1) ? The third (2) ?
- forward str_find(string[], lenght, character, count);
- public str_find(string[], lenght, character, count)
- {
- //return strfind(string, character, true);
- new charcounter = 0;
- for(new i = 0; i < lenght; i++)
- {
- if(string[i] == 0) break; // EOS
- if(string[i] == character)
- {
- if(charcounter == count)
- return i;
- charcounter++;
- }
- }
- return -1;
- }
- forward sub_str(string[], target[], from, to);
- public sub_str(string[], target[], from, to)
- {
- /*new charcounter = 0;
- for(new i = from; i <= to; i++)
- {
- target[charcounter] = string[i];
- charcounter++;
- }
- target[charcounter] = 0;*/
- strmid(target, string, from, to, (to - from) + 1);
- return true;
- }
- // I took this from my last Anticheat
- forward IsDrivebyVehicle(vehiclemodel);
- public IsDrivebyVehicle(vehiclemodel)
- {
- if(vehiclemodel == 425) { return true; } // Hunter
- if(vehiclemodel == 432) { return true; } // Rhino
- if(vehiclemodel == 447) { return true; } // Seasparrow
- if(vehiclemodel == 472) { return true; } // Not shure, I think Coastguard can shoot ?!?
- if(vehiclemodel == 520) { return true; } // Hydra
- return false;
- }
- forward IsAPlane(vehiclemodel);
- public IsAPlane(vehiclemodel)
- {
- if(vehiclemodel == 460) { return true; }
- if(vehiclemodel == 476) { return true; }
- if(vehiclemodel == 511) { return true; }
- if(vehiclemodel == 512) { return true; }
- if(vehiclemodel == 513) { return true; }
- if(vehiclemodel == 519) { return true; }
- if(vehiclemodel == 520) { return true; }
- if(vehiclemodel == 533) { return true; }
- if(vehiclemodel == 553) { return true; }
- if(vehiclemodel == 577) { return true; }
- if(vehiclemodel == 592) { return true; }
- if(vehiclemodel == 593) { return true; }
- return false;
- }
- forward IsABike(vehiclemodel);
- public IsABike(vehiclemodel)
- {
- if(vehiclemodel == 448) { return true; }
- if(vehiclemodel == 461) { return true; }
- if(vehiclemodel == 462) { return true; }
- if(vehiclemodel == 463) { return true; }
- if(vehiclemodel == 468) { return true; }
- if(vehiclemodel == 471) { return true; }
- if(vehiclemodel == 481) { return true; }
- if(vehiclemodel == 509) { return true; }
- if(vehiclemodel == 510) { return true; }
- if(vehiclemodel == 521) { return true; }
- if(vehiclemodel == 522) { return true; }
- if(vehiclemodel == 523) { return true; }
- if(vehiclemodel == 281) { return true; }
- if(vehiclemodel == 586) { return true; }
- return false;
- }
- forward IsATrain(vehiclemodel);
- public IsATrain(vehiclemodel)
- {
- if(vehiclemodel == 537) { return true; }
- if(vehiclemodel == 538) { return true; }
- if(vehiclemodel == 569) { return true; }
- if(vehiclemodel == 570) { return true; }
- if(vehiclemodel == 590) { return true; }
- return false;
- }
- forward LogText(text[]);
- public LogText(text[])
- {
- new year, month, day, hour, minute, second, string[128];
- getdate(year, month, day);
- gettime(hour, minute, second);
- format(string, 128, "<%d.%d.%d %d:%d> %s\r\n", day, month, year, hour, minute, text);
- new File:logfile = fopen("DT_AntiCheat/log.txt", io_append);
- fwrite(logfile, text);
- fclose(logfile);
- printf(text);
- return true;
- }
- forward WarnPlayer(playerid, warns, reason[]);
- public WarnPlayer(playerid, warns, reason[])
- {
- new string[128];
- DTAC_Player[playerid][apWarns] += warns;
- if(DTAC_Player[playerid][apWarns] >= 3)
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "AC: You have beenkicked, reason: %s", reason);
- SendClientMessage(playerid, 0xFFFF00, string);
- Kick(playerid);
- #endif
- }
- else
- {
- #if defined SILENT_MODE
- #else
- format(string, 128, "AC: You got a warning, reason: %s", reason);
- SendClientMessage(playerid, 0xFFFF00, string);
- #endif
- }
- return true;
- }
- forward CrashPlayer(playerid);
- public CrashPlayer(playerid)
- {
- new rand = random(3);
- switch(rand)
- {
- // Wrong Skin -> SAMP crash
- case 0: { return SetPlayerSkin(playerid, -1); }
- // Division through zero -> nullpointer at client
- case 1: { return SetPlayerVelocity(playerid, (5.0/0), (5.0/0), (5.0/0)); }
- // To much speed ( 16777215 m/s ) -> crash
- case 2: { return SetPlayerVelocity(playerid, 0xFFFFFF, 0xFFFFFF, 0xFFFFFF); }
- }
- return true;
- }
- forward BanPlayer(playerid);
- public BanPlayer(playerid)
- {
- new string[128], name[32];
- GetPlayerName(playerid, name, 32);
- format(string, 128, "DT_Anticheat/%s.ban", name);
- new File:file = fopen(string, io_write);
- format(string, 128, "time=%d", GetTimestamp());
- fwrite(file, string);
- fclose(file);
- return true;
- }
- forward GetWeaponSlot(weaponid);
- public GetWeaponSlot(weaponid)
- {
- switch(weaponid)
- {
- case 0: return 0;
- case 1: return 0;
- case 2: return 1;
- case 3: return 1;
- case 4: return 1;
- case 5: return 1;
- case 6: return 1;
- case 7: return 1;
- case 8: return 1;
- case 9: return 1;
- case 10: return 10;
- case 11: return 10;
- case 12: return 10;
- case 13: return 10;
- case 14: return 10;
- case 15: return 10;
- case 16: return 8;
- case 17: return 8;
- case 18: return 8;
- case 22: return 2;
- case 23: return 2;
- case 24: return 2;
- case 25: return 3;
- case 26: return 3;
- case 27: return 3;
- case 28: return 4;
- case 29: return 4;
- case 30: return 5;
- case 31: return 5;
- case 32: return 4;
- case 33: return 6;
- case 34: return 6;
- case 35: return 7;
- case 36: return 7;
- case 37: return 7;
- case 38: return 7;
- case 39: return 8;
- case 40: return 12;
- case 41: return 9;
- case 42: return 9;
- case 43: return 9;
- case 44: return 11;
- case 45: return 11;
- case 46: return 11;
- default: return -1;
- }
- return -1; // to prevent a warning ^^
- }
- forward GetTimestamp();
- public GetTimestamp()
- {
- new _sek, _min, _hour, _day, _month, _year, _timestamp;
- getdate(_year, _month, _day);
- gettime(_hour, _min, _sek);
- _timestamp = _sek;
- _timestamp += _min * 60;
- _timestamp += _hour * 60 * 60;
- _timestamp += _day * 60 * 60 * 24;
- _timestamp += _month * 60 * 60 * 24 * 31;
- _timestamp += (_year - 1980) * 60 * 60 * 24 * 31 * 12;
- return _timestamp;
- }
- forward FormTimestamp(form[], timestamp, returnvar[], returnsize);
- public FormTimestamp(form[], timestamp, returnvar[], returnsize)
- {
- new count = 0;
- format(returnvar, returnsize, "");
- new _year, _month, _day, _hour, _min, _sec;
- while(timestamp >= 32140800) { _year++; timestamp -= 32140800; }
- while(timestamp >= 2678400) { _month++; timestamp -= 2678400; }
- while(timestamp >= 86400) { _day++; timestamp -= 86400; }
- while(timestamp >= 3600) { _hour++; timestamp -= 3600; }
- while(timestamp >= 60) { _min++; timestamp -= 60; }
- _sec = timestamp;
- while(form[count])
- {
- if(form[count] == 's')
- {
- format(returnvar, returnsize, "%s%d", returnvar, _sec);
- }
- else if(form[count] == 'S')
- {
- if(_sec < 10)
- format(returnvar, returnsize, "%s0%d", returnvar, _sec);
- else
- format(returnvar, returnsize, "%s%d", returnvar, _sec);
- }
- else if(form[count] == 'm')
- {
- format(returnvar, returnsize, "%s%d", returnvar, _min);
- }
- else if(form[count] == 'M')
- {
- if(_min < 10)
- format(returnvar, returnsize, "%s0%d", returnvar, _min);
- else
- format(returnvar, returnsize, "%s%d", returnvar, _min);
- }
- else if(form[count] == 'h')
- {
- format(returnvar, returnsize, "%s%d", returnvar, _hour);
- }
- else if(form[count] == 'H')
- {
- if(_hour < 10)
- format(returnvar, returnsize, "%s0%d", returnvar, _hour);
- else
- format(returnvar, returnsize, "%s%d", returnvar, _hour);
- }
- else if(form[count] == 'd')
- {
- format(returnvar, returnsize, "%s%d", returnvar, _day);
- }
- else if(form[count] == 'D')
- {
- if(_day < 10)
- format(returnvar, returnsize, "%s0%d", returnvar, _day);
- else
- format(returnvar, returnsize, "%s%d", returnvar, _day);
- }
- else if(form[count] == 'z')
- {
- format(returnvar, returnsize, "%s%d", returnvar, _month);
- }
- else if(form[count] == 'Z')
- {
- if(_month < 10)
- format(returnvar, returnsize, "%s0%d", returnvar, _month);
- else
- format(returnvar, returnsize, "%s%d", returnvar, _month);
- }
- else if(form[count] == 'y')
- {
- format(returnvar, returnsize, "%s%d", returnvar, _year);
- }
- else if(form[count] == 'Y')
- {
- if(_year < 10)
- format(returnvar, returnsize, "%s0%d", returnvar, _year);
- else
- format(returnvar, returnsize, "%s%d", returnvar, _year);
- }
- else
- format(returnvar, returnsize, "%s%s", returnvar, form[count]);
- count++;
- }
- return true;
- }
- /********************************************************************************************/
- /* THE HOOKED CALLBACKS FROM EVERY GM / FS */
- /********************************************************************************************/
- forward _AC_GivePlayerMoney(playerid, themoney);
- forward _AC_ResetPlayerMoney(playerid);
- public _AC_GivePlayerMoney(playerid, themoney)
- {
- DTAC_Player[playerid][apFreeTime] = FREETIME_MONEY;
- DTAC_Player[playerid][apMoney] += themoney;
- GivePlayerMoney(playerid, themoney);
- return true;
- }
- public _AC_ResetPlayerMoney(playerid)
- {
- DTAC_Player[playerid][apFreeTime] = FREETIME_MONEY;
- DTAC_Player[playerid][apMoney] = 0;
- ResetPlayerMoney(playerid);
- return true;
- }
- forward _AC_SetPlayerPos(playerid, Float:x, Float:y, Float:z);
- forward _AC_SetPlayerPosFindZ(playerid, Float:x, Float:y, Float:z);
- forward _AC_SetPlayerVelocity(playerid, Float:x, Float:y, Float:z);
- forward _AC_SetVehicleVelocity(vehicleid, Float:x, Float:y, Float:z);
- forward _AC_SetVehiclePos(vehicleid, Float:x, Float:y, Float:z);
- public _AC_SetPlayerPos(playerid, Float:x, Float:y, Float:z)
- {
- DTAC_Player[playerid][apFreeTime] = FREETIME_TELEPORT;
- DTAC_Player[playerid][apPosition][0] = x;
- DTAC_Player[playerid][apPosition][1] = y;
- DTAC_Player[playerid][apPosition][2] = z;
- SetPlayerPos(playerid, x, y, z);
- return true;
- }
- public _AC_SetPlayerPosFindZ(playerid, Float:x, Float:y, Float:z)
- {
- DTAC_Player[playerid][apFreeTime] = FREETIME_TELEPORT;
- DTAC_Player[playerid][apPosition][0] = x;
- DTAC_Player[playerid][apPosition][1] = y;
- DTAC_Player[playerid][apPosition][2] = 0.0;
- SetPlayerPosFindZ(playerid, x, y, z);
- return true;
- }
- public _AC_SetPlayerVelocity(playerid, Float:x, Float:y, Float:z)
- {
- DTAC_Player[playerid][apFreeTime] = FREETIME_TELEPORT;
- DTAC_Player[playerid][apPosition][0] += x;
- DTAC_Player[playerid][apPosition][1] += y;
- DTAC_Player[playerid][apPosition][2] += z;
- SetPlayerVelocity(playerid, x, y, z);
- return true;
- }
- public _AC_SetVehicleVelocity(vehicleid, Float:x, Float:y, Float:z)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && IsPlayerInVehicle(i, vehicleid))
- {
- DTAC_Player[i][apFreeTime] = FREETIME_TELEPORT;
- DTAC_Player[i][apPosition][0] += x;
- DTAC_Player[i][apPosition][1] += y;
- DTAC_Player[i][apPosition][2] += z;
- }
- }
- SetVehicleVelocity(vehicleid, x, y, z);
- return true;
- }
- public _AC_SetVehiclePos(vehicleid, Float:x, Float:y, Float:z)
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && IsPlayerInVehicle(i, vehicleid))
- {
- DTAC_Player[i][apFreeTime] = FREETIME_TELEPORT;
- DTAC_Player[i][apPosition][0] = x;
- DTAC_Player[i][apPosition][1] = y;
- DTAC_Player[i][apPosition][2] = z;
- }
- }
- SetVehiclePos(vehicleid, x, y, z);
- return true;
- }
- forward _AC_SetPlayerHealth(playerid, Float:health);
- forward _AC_SetPlayerArmour(playerid, Float:setarmour);
- public _AC_SetPlayerHealth(playerid, Float:health)
- {
- DTAC_Player[playerid][apHealth] = health;
- DTAC_Player[playerid][apFreeTime] = FREETIME_HEALTH;
- SetPlayerHealth(playerid, health);
- return true;
- }
- public _AC_SetPlayerArmour(playerid, Float:setarmour)
- {
- DTAC_Player[playerid][apArmour] = setarmour;
- DTAC_Player[playerid][apFreeTime] = FREETIME_HEALTH;
- SetPlayerArmour(playerid, setarmour);
- return true;
- }
- forward _AC_GivePlayerWeapon(playerid, weaponid, ammo2);
- forward _AC_ResetPlayerWeapons(playerid);
- public _AC_GivePlayerWeapon(playerid, weaponid, ammo2)
- {
- new weaponslot = GetWeaponSlot(weaponid);
- if(weaponslot < 0 || weaponslot > 12) return false;
- DTAC_Player[playerid][apFreeTime] = FREETIME_WEAPON;
- DTAC_Player[playerid][apWeapons][weaponslot] = weaponid;
- if(DTAC_Player[playerid][apAmmo][weaponslot] == -1 || DTAC_Player[playerid][apAmmo][weaponslot] == 0)
- DTAC_Player[playerid][apAmmo][weaponslot] = ammo2;
- else
- DTAC_Player[playerid][apAmmo][weaponslot] += ammo2;
- GivePlayerWeapon(playerid, weaponid, ammo2);
- return true;
- }
- public _AC_ResetPlayerWeapons(playerid)
- {
- ResetPlayerWeapons(playerid);
- for(new i = 0; i < 13; i++)
- {
- DTAC_Player[playerid][apWeapons][i] = -1;
- DTAC_Player[playerid][apAmmo][i] = -1;
- }
- return true;
- }
- forward _AC_AddPlayerClass(skin2, Float:SpawnX, Float:SpawnY, Float:SpawnZ, Float:SpawnA, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3);
- forward _AC_AddPlayerClassEx(teamid, skin2, Float:SpawnX, Float:SpawnY, Float:SpawnZ, Float:SpawnA, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3);
- public _AC_AddPlayerClass(skin2, Float:SpawnX, Float:SpawnY, Float:SpawnZ, Float:SpawnA, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3)
- {
- new id = AddPlayerClass(skin2, SpawnX, SpawnY, SpawnZ, SpawnA, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3);
- SpawnClasses[id][team] = -1;
- SpawnClasses[id][skin] = skin2;
- SpawnClasses[id][spawnx] = SpawnX;
- SpawnClasses[id][spawny] = SpawnY;
- SpawnClasses[id][spawny] = SpawnZ;
- SpawnClasses[id][spawna] = SpawnA;
- SpawnClasses[id][weapons][0] = weapon1;
- SpawnClasses[id][ammo][0] = ammo1;
- SpawnClasses[id][weapons][1] = weapon2;
- SpawnClasses[id][ammo][1] = ammo2;
- SpawnClasses[id][weapons][2] = weapon3;
- SpawnClasses[id][ammo][2] = ammo3;
- return id;
- }
- public _AC_AddPlayerClassEx(teamid, skin2, Float:SpawnX, Float:SpawnY, Float:SpawnZ, Float:SpawnA, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3)
- {
- new id = AddPlayerClassEx(teamid, skin2, SpawnX, SpawnY, SpawnZ, SpawnA, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3);
- SpawnClasses[id][team] = teamid;
- SpawnClasses[id][skin] = skin2;
- SpawnClasses[id][spawnx] = SpawnX;
- SpawnClasses[id][spawny] = SpawnY;
- SpawnClasses[id][spawny] = SpawnZ;
- SpawnClasses[id][spawna] = SpawnA;
- SpawnClasses[id][weapons][0] = weapon1;
- SpawnClasses[id][ammo][0] = ammo1;
- SpawnClasses[id][weapons][1] = weapon2;
- SpawnClasses[id][ammo][1] = ammo2;
- SpawnClasses[id][weapons][2] = weapon3;
- SpawnClasses[id][ammo][2] = ammo3;
- return id;
- }
- /********************************************************************************************/
- /* THE CERNEL FUNCTION */
- /********************************************************************************************/
- forward OnAnticheatUpdate();
- public OnAnticheatUpdate()
- {
- new Float:tmpx, Float:tmpy, Float:tmpz, Float:tmpa, Float: distance;
- new Float:tmphp, Float:tmparmour, tmpmoney;
- new bool:tmplostmoney;
- new string[128], name[32];
- new vehicleid;
- new keyleft, keyright, keys;
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- if(!IsPlayerConnected(playerid)) continue;
- if(DTAC_Player[playerid][apFreeTime] >= 1)
- {
- DTAC_Player[playerid][apFreeTime]--;
- // To prevent kick when running and beeing in "free mode"
- GetPlayerPos(playerid, DTAC_Player[playerid][apPosition][0], DTAC_Player[playerid][apPosition][1], DTAC_Player[playerid][apPosition][2]);
- continue;
- }
- if(DTAC_Player[playerid][apUnkillableTime] >= 1)
- {
- DTAC_Player[playerid][apUnkillableTime]--;
- if(DTAC_Config[spawnkill] == CHEAT_STATUS_UNDO)
- {
- DTAC_Player[playerid][apHealth] = 65534.0;
- SetPlayerHealth(playerid, 65534.0);
- if(DTAC_Player[playerid][apUnkillableTime] == 0)
- {
- DTAC_Player[playerid][apHealth] = 100.0;
- SetPlayerHealth(playerid, 100.0);
- }
- }
- }
- tmplostmoney = false;
- GetPlayerPos(playerid, tmpx, tmpy, tmpz);
- if(IsPlayerInAnyVehicle(playerid))
- GetVehicleZAngle(GetPlayerVehicleID(playerid), tmpa);
- else
- GetPlayerFacingAngle(playerid, tmpa);
- GetPlayerHealth(playerid, tmphp);
- GetPlayerArmour(playerid, tmparmour);
- tmpmoney = GetPlayerMoney(playerid);
- GetPlayerKeys(playerid, keys, keyleft, keyright);
- new Float:distancex, Float:distancey, Float:distancez;
- if(DTAC_Player[playerid][apPosition][0] > tmpx)
- distancex = DTAC_Player[playerid][apPosition][0] - tmpx;
- else
- distancex = tmpx - DTAC_Player[playerid][apPosition][0];
- if(DTAC_Player[playerid][apPosition][1] > tmpy)
- distancey = DTAC_Player[playerid][apPosition][1] - tmpy;
- else
- distancey = tmpy - DTAC_Player[playerid][apPosition][1];
- if(DTAC_Player[playerid][apPosition][2] > tmpz)
- distancez = DTAC_Player[playerid][apPosition][2] - tmpz;
- else
- distancez = tmpz - DTAC_Player[playerid][apPosition][2];
- distance = floatsqroot(distancex * distancex + distancey * distancey + distancez * distancez);
- GetPlayerName(playerid, name, 32);
- if(IsPlayerInAnyVehicle(playerid))
- vehicleid = GetPlayerVehicleID(playerid);
- else if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID)
- vehicleid = GetPlayerSurfingVehicleID(playerid);
- else
- vehicleid = INVALID_VEHICLE_ID;
- /* Money hack */
- if(DTAC_Config[money] > CHEAT_STATUS_OFF)
- {
- if(DTAC_Player[playerid][apMoney] > tmpmoney)
- {
- // He lost Money :)
- tmplostmoney = true;
- DTAC_Player[playerid][apMoney] = tmpmoney;
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, tmpmoney);
- }
- else if(DTAC_Player[playerid][apMoney] < tmpmoney)
- {
- // Cheat Oo
- format(string, 128, "%s tryes to cheat ( Money cheat )", name);
- LogText(string);
- switch(DTAC_Config[money])
- {
- case CHEAT_STATUS_UNDO:
- {
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, DTAC_Player[playerid][apMoney]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "Money cheat");
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, DTAC_Player[playerid][apMoney]);
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( money cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( money cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- /* spam */
- if(DTAC_Config[spam] > CHEAT_STATUS_OFF)
- {
- if(DTAC_Player[playerid][apMuted] >= 1) DTAC_Player[playerid][apMuted]--;
- if(DTAC_Player[playerid][apSpamMessages] >= 3)
- {
- DTAC_Player[playerid][apSpamMessages] = 0;
- DTAC_Player[playerid][apMuted] += DTAC_Player[playerid][apSpamMessages] * 20;
- }
- DTAC_Player[playerid][apSpamMessages]--;
- }
- /* health */
- if(DTAC_Config[heal] > CHEAT_STATUS_OFF)
- {
- if(tmphp > DTAC_Player[playerid][apHealth])
- {
- if(tmplostmoney)
- {
- // Healed on a vending machine or a bs
- SetPlayerHealth(playerid, tmphp);
- }
- else
- {
- // Cheater !
- format(string, 128, "%s tryes to cheat ( health cheat / has %.1f, should have %.1f )", name, tmphp, DTAC_Player[playerid][apHealth]);
- LogText(string);
- switch(DTAC_Config[heal])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerHealth(playerid, DTAC_Player[playerid][apHealth]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "heal cheat");
- SetPlayerHealth(playerid, DTAC_Player[playerid][apHealth]);
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( heal cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( heal cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- else if(tmphp < DTAC_Player[playerid][apHealth])
- {
- DTAC_Player[playerid][apHealth] = tmphp;
- }
- }
- /* armour */
- if(DTAC_Config[armour] > CHEAT_STATUS_OFF)
- {
- if(tmparmour > DTAC_Player[playerid][apArmour])
- {
- if(tmplostmoney)
- {
- // Healed on a vending machine or a bs
- SetPlayerArmour(playerid, tmparmour);
- }
- else
- {
- // Cheater !
- format(string, 128, "%s tryes to cheat ( armour cheat )", name);
- LogText(string);
- switch(DTAC_Config[heal])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerArmour(playerid, DTAC_Player[playerid][apArmour]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "armour cheat");
- SetPlayerArmour(playerid, DTAC_Player[playerid][apArmour]);
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( armour cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( armour cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- else if(tmparmour < DTAC_Player[playerid][apArmour])
- {
- DTAC_Player[playerid][apArmour] = tmparmour;
- }
- }
- /* Jetpack */
- if(DTAC_Config[jetpack] > CHEAT_STATUS_OFF)
- {
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
- {
- format(string, 128, "%s tryes to cheat ( jetpack cheat )", name);
- LogText(string);
- switch(DTAC_Config[jetpack])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "jetpack cheat");
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( jetpack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( armour cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- /* Speed */
- if(DTAC_Config[speed] > CHEAT_STATUS_OFF)
- {
- //new Float:tmpx, Float:tmpy, Float:tmpz;
- if(vehicleid != INVALID_VEHICLE_ID)
- {
- if(IsAPlane(GetVehicleModel(vehicleid)) && distance >= 150)
- {
- format(string, 128, "%s trys to cheat ( plane, speedhack, %.1f m/s )", name, distance);
- LogText(string);
- switch(DTAC_Config[speed])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerPos(playerid, DTAC_Player[playerid][apPosition][0], DTAC_Player[playerid][apPosition][1], DTAC_Player[playerid][apPosition][2]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "airbreak / speedhack / flyhack cheat");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- else if(IsABike(GetVehicleModel(vehicleid)) && distance >= 100)
- {
- format(string, 128, "%s trys to cheat ( bike, speedhack, %.1f m/s )", name, distance);
- LogText(string);
- switch(DTAC_Config[speed])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerPos(playerid, DTAC_Player[playerid][apPosition][0], DTAC_Player[playerid][apPosition][1], DTAC_Player[playerid][apPosition][2]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "airbreak / speedhack / flyhack cheat");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- else if(IsATrain(GetVehicleModel(vehicleid)) && distance >= 100)
- {
- format(string, 128, "%s trys to cheat ( train, speedhack, %.1f m/s )", name, distance);
- LogText(string);
- switch(DTAC_Config[speed])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerPos(playerid, DTAC_Player[playerid][apPosition][0], DTAC_Player[playerid][apPosition][1], DTAC_Player[playerid][apPosition][2]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "airbreak / speedhack / flyhack cheat");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- else if(distance >= 80)
- {
- format(string, 128, "%s trys to cheat ( other car, speedhack, %.1f m/s )", name, distance);
- LogText(string);
- switch(DTAC_Config[speed])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerPos(playerid, DTAC_Player[playerid][apPosition][0], DTAC_Player[playerid][apPosition][1], DTAC_Player[playerid][apPosition][2]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "airbreak / speedhack / flyhack cheat");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating (, airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- else
- {
- if(distance >= 15)
- {
- format(string, 128, "%s trys to cheat ( onfoot, airbreak, %.1f m/s )", name, distance);
- LogText(string);
- switch(DTAC_Config[speed])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetPlayerPos(playerid, DTAC_Player[playerid][apPosition][0], DTAC_Player[playerid][apPosition][1], DTAC_Player[playerid][apPosition][2]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "airbreak / speedhack / flyhack cheat");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( airbreak / speedhack / flyhack cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- }
- /* Weapon */
- if(DTAC_Config[weapon] > CHEAT_STATUS_OFF)
- {
- #if defined SAVE_RECOURCES
- new weaponid = GetPlayerWeapon(playerid);
- new weaponslot = GetWeaponSlot(weaponid);
- if(weaponslot != 0 && weaponslot != -1 && weaponid != 0 && weaponid != -1)
- {
- if(weaponid != DTAC_Player[playerid][apWeapons][weaponslot] && weaponid != 46)
- {
- format(string, 128, "%s trys to cheat ( weapon: %d )", name, weaponid);
- LogText(string);
- switch(DTAC_Config[weapon])
- {
- case CHEAT_STATUS_UNDO:
- {
- _AC_ResetPlayerWeapons(playerid);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "weapon cheat");
- _AC_ResetPlayerWeapons(playerid);
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( weapon cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( weapon cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- #else
- new weaponid, ammoamount;
- for(new i = 0; i < 13; i++)
- {
- GetPlayerWeaponData(playerid, i, weaponid, ammoamount);
- if(weaponid == 0 && DTAC_Player[playerid][apWeapons][i] != 0)
- {
- DTAC_Player[playerid][apWeapons][i] = 0;
- DTAC_Player[playerid][apAmmo][i] = 0;
- }
- else if(weaponid != 0 && DTAC_Player[playerid][apWeapons][i] == 0 || weaponid != 0 && DTAC_Player[playerid][apWeapons][i] == 1)
- {
- if(weaponid == 46)
- {
- DTAC_Player[playerid][apWeapons][i] = 46;
- }
- else
- {
- format(string, 128, "%s trys to cheat ( weapon: %d )", name, weaponid);
- LogText(string);
- switch(DTAC_Config[weapon])
- {
- case CHEAT_STATUS_UNDO:
- {
- _AC_ResetPlayerWeapons(playerid);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "weapon cheat");
- _AC_ResetPlayerWeapons(playerid);
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( weapon cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( weapon cheat )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- } // end switch
- }
- }
- }
- #endif
- }
- /* quickturn */
- if(DTAC_Config[quickturn] > CHEAT_STATUS_OFF && IsPlayerInAnyVehicle(playerid))
- {
- new Float:anglechange = DTAC_Player[playerid][apAngle] - tmpa;
- if(anglechange < 0.0) anglechange += 360.0;
- else if(anglechange > 360.0) anglechange -= 360.0;
- if(anglechange == 180.0)
- {
- format(string, 128, "%s trys to cheat ( fastturn: %.1f° )", name, anglechange);
- LogText(string);
- switch(DTAC_Config[weapon])
- {
- case CHEAT_STATUS_UNDO:
- {
- SetVehicleZAngle(GetPlayerVehicleID(playerid), DTAC_Player[playerid][apAngle]);
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "weapon cheat");
- SetVehicleZAngle(GetPlayerVehicleID(playerid), DTAC_Player[playerid][apAngle]);
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due cheating ( fastturn )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due cheating ( fastturn )", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- } // end switch
- }
- }
- /* joypad */
- if(DTAC_Config[joypad] > CHEAT_STATUS_OFF)
- {
- if((keyleft != 128 && keyleft != 0 && keyleft != -128) || (keyright != 128 && keyright != 0 && keyright != -128))
- {
- switch(DTAC_Config[joypad])
- {
- case CHEAT_STATUS_UNDO:
- {
- SendClientMessage(playerid, 0xFF0000FF, "Please turn off your Joypad");
- }
- case CHEAT_STATUS_WARN:
- {
- WarnPlayer(playerid, 1, "joypad");
- }
- case CHEAT_STATUS_KICK:
- {
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been kicked due using joypad", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- case CHEAT_STATUS_BAN:
- {
- BanPlayer(playerid);
- #if defined SILENT_MODE
- CrashPlayer(playerid);
- #else
- format(string, 128, "%s has been banned due using joypad", name);
- SendClientMessageToAll(0xFF0000FF, string);
- Kick(playerid);
- #endif
- }
- }
- }
- }
- if(IsPlayerInAnyVehicle(playerid))
- GetVehicleZAngle(GetPlayerVehicleID(playerid), DTAC_Player[playerid][apAngle]);
- else
- GetPlayerFacingAngle(playerid, DTAC_Player[playerid][apAngle]);
- GetPlayerPos(playerid, DTAC_Player[playerid][apPosition][0], DTAC_Player[playerid][apPosition][1], DTAC_Player[playerid][apPosition][2]);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement