Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define MAX_COMMANDS (500)
- new g_str_CommandsNames[MAX_COMMANDS][25];
- stock strtok(str[], str2[], &idx, separator = ',')
- {
- new i;
- while(str[idx] != separator && idx < 25)
- {
- if(str[idx] != '/')
- {
- str2[i] = str[idx];
- i++;
- }
- idx++;
- }
- str2[i] = EOS;
- idx++;
- }
- stock ReadFile()
- {
- new
- File: File,
- str_FileText[256],
- i;
- File = fopen("bcommands.ini", io_read);
- while(fread(File, str_FileText, sizeof(str_FileText)))
- {
- if(strfind(str_FileText, "Type here the commands", true) != -1)
- continue;
- new idx;
- strtok(str_FileText,g_str_CommandsNames[i], idx);
- i++;
- }
- fclose(File);
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------\n Commands blocker \
- script\n Loaded\n By Conan/Destrojer \n--------------------------\
- ------------");
- if(!fexist("bcommands.ini"))
- {
- new File: File;
- File = fopen("bcommands.ini", io_append);
- fwrite(File, "Type here the commands that are to be blocked. \
- Separate theme with ','\r\n");
- fwrite(File, "command1,\r\n");
- fwrite(File, "command2,\r\n");
- fwrite(File, "command3,\r\n");
- fwrite(File, "etc,\r\n");
- fclose(File);
- return 1;
- }
- ReadFile();
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------\n Commands blocker \
- script\n Unloaded\n By Conan/Destrojer \n------------------------\
- --------------");
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext[1], "reload", true) == 0)
- {
- if(!IsPlayerAdmin(playerid))
- return 0;
- ReadFile();
- SendClientMessage(playerid, 0xDDAD66FF, "****Reload compited***");
- return 1;
- }
- for(new i; i < MAX_COMMANDS; i++)
- if(strcmp(cmdtext[1], g_str_CommandsNames[i], true,
- strlen(g_str_CommandsNames[i])) == 0 &&
- strlen(g_str_CommandsNames[i]) > 0)
- return SendClientMessage(playerid, 0xDDAD66FF,
- "Sorry. This command is blocked");
- return 0;
- }
- /*------------------------------------------------------------------------------
- You are the only one who read that. JOKE.
- ------------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement