Advertisement
YourMain12

Basic Anticheat (MATLAB)

Jan 7th, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.86 KB | None | 0 0
  1. % Set a flag to determine if the user is cheating
  2. isCheating = false;
  3.  
  4. % Define a function to check if the user is cheating
  5. function checkForCheats(input)
  6.     % Set a list of cheats
  7.     cheats = {'cheat1', 'cheat2', 'cheat3'};
  8.  
  9.     % Iterate through the list of cheats
  10.     for i = 1:length(cheats)
  11.         % If the input contains a cheat, set the flag to true and break out of the loop
  12.         if ~isempty(strfind(input, cheats{i}))
  13.             isCheating = true;
  14.             break;
  15.         end
  16.     end
  17. end
  18.  
  19. % Prompt the user for input
  20. input = input('Enter a command: ', 's');
  21.  
  22. % Check if the user is cheating
  23. checkForCheats(input);
  24.  
  25. % If the user is cheating, display a message and exit the program
  26. if isCheating
  27.     disp('Cheating is not allowed!');
  28.     return;
  29. end
  30.  
  31. % If the user is not cheating, continue with the program
  32. disp('Valid input');
  33.  
Tags: Matlab
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement