daily pastebin goal
50%
SHARE
TWEET

Untitled

a guest Jan 22nd, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define COLOR_GREEN 0x7CFC00
  2. #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
  3. #define SCM SendClientMessage
  4. #include <a_samp>
  5. #include <Timeban>
  6. #pragma tabsize 0
  7. new AdminLevel[MAX_PLAYERS];
  8. new strk[128];
  9. new strl[128];
  10.  
  11.  
  12.  
  13. stock PlayerName(playerid)
  14. {
  15. new
  16. playername[MAX_PLAYER_NAME];
  17. GetPlayerName(playerid, playername, sizeof(playername));
  18. return playername;
  19. }
  20.  
  21. stock Jmeno(playerid)
  22. {
  23. new name[25];
  24. GetPlayerName(playerid, name, 25);
  25. return name;
  26. }
  27.  
  28. public OnFilterScriptInit()
  29. {
  30.     return 1;
  31. }
  32.  
  33. public OnFilterScriptExit()
  34. {
  35.     return 1;
  36. }
  37.  
  38. public OnPlayerConnect(playerid)
  39. {
  40.     if(IsPlayerBanned(playerid))
  41.     {
  42.         new string[255], IP[16], TimeArray[6][5];
  43.         format(IP, 255, "%s-",PlayerIP(playerid));
  44.         format(string, 255, "%s",FindBannedIp(IP));
  45.         strdel(string,0,strlen(IP));
  46.         TimeFromString(string, TimeArray);
  47.         if(CompareDates(TimeArray))
  48.         {
  49.             format(string, 255, "%s-",PlayerIP(playerid));
  50.             RemoveIp(string);
  51.             SendClientMessage(playerid, 0xFFFFFFF, "Doba tvého banu vypršela.");
  52.         }
  53.         else
  54.         {
  55.             SendClientMessage(playerid, 0xFFFFFFF, "Byl jsi zabanován na tomto serveru!");
  56.             Kick(playerid);
  57.         }
  58.     }
  59.     return 1;
  60. }
  61.  
  62.  
  63. public OnPlayerCommandText(playerid, cmdtext[])
  64. {
  65.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  66.     {
  67.  
  68.         return 1;
  69.     }
  70.     dcmd(setadmin,8,cmdtext);
  71.     dcmd(ban,3,cmdtext);
  72.     return 0;
  73. }
  74.  
  75. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  76. {
  77.     if(dialogid == (2*MAX_PLAYERS)+playerid)
  78.     {
  79.         if(!response) return 0;
  80.         if(strlen(inputtext) < 11 || strlen(inputtext) > 23) return SendClientMessage(playerid,0xFF0404FF,"Zadal jsi špatný formát!");
  81.         format(BanTime, sizeof(BanTime), "%s", inputtext);
  82.         GiveTimeBanToPlayer(playerid, 1,BanTime);
  83.         return 1;
  84.     }
  85.     if(dialogid == (3*MAX_PLAYERS)+playerid)
  86.     {
  87.         if(!response) return 0;
  88.         new msg[1024], Pname[25], TimeArray[6][5], Aname[25];
  89.         GetPlayerName(BanedID, Pname, sizeof(Pname));
  90.         GetPlayerName(BanedID, Aname, sizeof(Aname));
  91.         TimeFromString(BanTime, TimeArray);
  92.         format(msg, sizeof(msg), "Hráč %s byl zabanován administrátorem %s na %s let, %s měsíců, %s dní, %s hodin, %s minut, %s sekund [Důvod: %s]",Pname,Aname,TimeArray[0],TimeArray[1],TimeArray[2],TimeArray[3], TimeArray[4], TimeArray[5], inputtext);
  93.         SendClientMessageToAll(0xFF0404FF, msg);
  94.         printf("[TimeBan] %s", msg);
  95.         BanPlayer(BanedID, BanTime);
  96.         Kick(BanedID);
  97.     }
  98.     return 1;
  99. }
  100.  
  101.  
  102.  
  103. dcmd_setadmin(playerid,params[])
  104. {
  105.     new ID = strval(params[0]);
  106.     new LEVEL = strval(params[1]);
  107.     if(AdminLevel[playerid] < 5)
  108.     {
  109.         format(strk,128,"Nastavil jsi hráči %s level %d." PlayerName(playerid),LEVEL);
  110.         format(strl,128,"Admin %s ti nastavil level %d." PlayerName(playerid),LEVEL);
  111.         AdminLevel[ID] = LEVEL;
  112.         SCM(ID,COLOR_GREEN,strl);
  113.         SCM(playerid,COLOR_GREEN,strk);
  114.     }
  115. else return 0;
  116. return 1;
  117. }
  118.  
  119. dcmd_ban(playerid, params[])
  120. {
  121. if(AdminLevel[playerid] == 1)
  122. {
  123. Ban(playerid);
  124. }
  125. else
  126. {
  127.     if (strlen(params)==0) return SendClientMessage(playerid,0xFF0404FF,"Použij [/timeban ID]");
  128.  
  129.     BanedID = strval(params);
  130.     if(!IsPlayerConnected(BanedID)) return SendClientMessage(playerid,0xFF0404FF,"Hráč s tímto ID není připojen!");
  131.  
  132.     GiveTimeBanToPlayer(playerid, 0, "");
  133.     return true;
  134. }
  135. return 1;
  136. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top