seroff

Auto Client CMD

Apr 22nd, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <amxmodx>
  2.  
  3. new Trie:gFile,sLen,szFile[]="addons/amxmodx/configs/autocmd.ini";
  4.  
  5. public plugin_init() {
  6. register_plugin("Auto Client CMD","1.0N","Seroff");
  7. if(!file_exists(szFile)) set_fail_state("File ^"autocmd.ini^" not found");
  8. sLen=0;
  9. gFile=TrieCreate();
  10. if(file_exists(szFile)){
  11. new iFilePointer = fopen( szFile, "r");
  12. if(iFilePointer){
  13. new szData[128],sLine[10];
  14. while(fgets(iFilePointer, szData, 127)){
  15. replace(szData, 127, "^n", "");
  16. replace(szData, 127, "^t", "");
  17. remove_quotes(szData);
  18. if(strlen(szData)>0){
  19. sLen++
  20. num_to_str ( sLen-1, sLine, charsmax(sLine) );
  21. TrieSetString(gFile,sLine,szData);
  22. }
  23. }
  24. fclose(iFilePointer);
  25. }
  26. }
  27. }
  28.  
  29. public client_authorized(id){
  30. new sLine[32],s_Buffer[512];
  31. for(new d=0;d<sLen;d++){
  32. num_to_str ( d, sLine, charsmax(sLine) );
  33. TrieGetString(gFile,sLine,s_Buffer,charsmax(s_Buffer));
  34. client_cmd(id,s_Buffer);
  35. }
  36. }
  37.  
  38. public plugin_end(){
  39. TrieDestroy(gFile);
  40. }
Advertisement
Add Comment
Please, Sign In to add comment