Guest User

Untitled

a guest
Jan 27th, 2010
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.09 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #define COLOR_GREEN     0x21DD00FF
  5. #define COLOR_RED       0xE60000FF
  6. #define COLOR_BLUE      0x1229FAFF
  7. #define COLOR_YELLOW    0xFFFF00FF
  8. new cpi[MAX_PLAYERS];
  9. new muted[MAX_PLAYERS];
  10. new website[] = "<change this to your website>";
  11. new warns[MAX_PLAYERS];
  12. forward Rules(playerid);
  13.  
  14. public Rules(playerid)
  15. {
  16.     SendClientMessage(playerid,COLOR_GREEN,"** Server Rules **");//Edit the rules to your wishes, add for each rule a new SendClientMessage
  17.     SendClientMessage(playerid,COLOR_GREEN,"1. Don't hack");
  18.     SendClientMessage(playerid,COLOR_GREEN,"2. Respect other players");
  19.     SendClientMessage(playerid,COLOR_GREEN,"3. Don't abuse ANY bugs.");
  20.     SendClientMessage(playerid,COLOR_GREEN,"4. Report cheaters/hackers.");
  21.     return 1;
  22. }
  23.  
  24. public OnPlayerText(playerid, text[])
  25. {
  26.     {
  27.         if(muted[playerid])
  28.         {
  29.             SendClientMessage(playerid,0xFF8080FF,"You're muted and can't talk!");
  30.             return 0;
  31.         }
  32.     }
  33.     return 1;
  34. }
  35.  
  36.  
  37. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  38. {
  39.     new string[128];
  40.     new pName[MAX_PLAYER_NAME], aName[MAX_PLAYER_NAME];
  41.     GetPlayerName(cpi[playerid],pName,sizeof(pName));
  42.     GetPlayerName(playerid,aName,sizeof(aName));
  43.     if(dialogid == 0)
  44.     {
  45.         if(response == 1)
  46.         {
  47.             if(listitem == 0)
  48.             {
  49.                 format(string,sizeof(string),"Enter your reason to kick %s",pName);
  50.                 ShowPlayerDialog(playerid,1,1,"Kick",string,"Kick","Cancel");
  51.             }
  52.             if(listitem == 1)
  53.             {
  54.                 format(string,sizeof(string),"Enter your reason to ban %s",pName);
  55.                 ShowPlayerDialog(playerid,2,1,"Ban",string,"Ban","Cancel");
  56.             }
  57.             if(listitem == 2)
  58.             {
  59.                 new Float:x,Float:y,Float:z;
  60.                 GetPlayerPos(cpi[playerid],x,y,z);
  61.                 SetPlayerPos(cpi[playerid],x,y,z+10);
  62.                 new listoptions[] = "1\tKick\n2\tBan\n3\tSlap\n4\tFreeze\n5\tUnfreeze\n6\tMute\n7\tUnmute\n8\tWarn\n9\tGoto\n10\tGethere";
  63.                 ShowPlayerDialog(playerid,0,2,"Admin options",listoptions,"Continue","Cancel");
  64.             }
  65.             if(listitem == 3)
  66.             {
  67.                 TogglePlayerControllable(cpi[playerid],0);
  68.                 ShowPlayerDialog(playerid,7,0,"Succes","Action performed succesfully!","Ok","Back");
  69.                 format(string,sizeof(string),"Admin %s froze you!",aName);
  70.                 ShowPlayerDialog(cpi[playerid],8,0,"Frozen!",string,"Ok","Damnit");
  71.             }
  72.             if(listitem == 4)
  73.             {
  74.                 TogglePlayerControllable(cpi[playerid],1);
  75.                 ShowPlayerDialog(playerid,7,0,"Succes","Action performed succesfully!","Ok","Back");
  76.                 format(string,sizeof(string),"Admin %s unfroze you!",aName);
  77.                 ShowPlayerDialog(cpi[playerid],8,0,"Frozen!",string,"YAAAY","Ok");
  78.             }
  79.             if(listitem == 5)
  80.             {
  81.                 muted[cpi[playerid]] = 1;
  82.                 ShowPlayerDialog(playerid,7,0,"Succes","Action performed succesfully!","Ok","Back");
  83.                 format(string,sizeof(string),"Admin %s muted you!",aName);
  84.                 ShowPlayerDialog(cpi[playerid],8,0,"Muted!",string,"Ok","Damnit");
  85.             }
  86.             if(listitem == 6)
  87.             {
  88.                 muted[cpi[playerid]] = 0;
  89.                 ShowPlayerDialog(playerid,7,0,"Succes","Action performed succesfully!","Ok","Back");
  90.                 format(string,sizeof(string),"Admin %s unmuted you!",aName);
  91.                 ShowPlayerDialog(cpi[playerid],8,0,"Muted!",string,"YAAAY","Ok");
  92.             }
  93.             if(listitem == 7)
  94.             {
  95.                 format(string,sizeof(string),"Enter your reason to warn %s.",pName);
  96.                 ShowPlayerDialog(playerid,3,1,"Succes",string,"Ok","Back");
  97.             }
  98.             if(listitem == 8)
  99.             {
  100.                 new Float:x,Float:y,Float:z;
  101.                 GetPlayerPos(cpi[playerid],x,y,z);
  102.                 SetPlayerPos(playerid,x,y-2,z);
  103.                 new interior = GetPlayerInterior(cpi[playerid]);
  104.                 new vw = GetPlayerVirtualWorld(cpi[playerid]);
  105.                 SetPlayerInterior(playerid,interior);
  106.                 SetPlayerVirtualWorld(playerid,vw);
  107.                 format(string,sizeof(string),"Succesfully teleported to %s!",pName);
  108.                 ShowPlayerDialog(playerid,7,0,"Succes",string,"Ok","Back");
  109.             }
  110.             if(listitem == 9)
  111.             {
  112.                 new Float:x,Float:y,Float:z;
  113.                 GetPlayerPos(playerid,x,y,z);
  114.                 SetPlayerPos(cpi[playerid],x,y-2,z);
  115.                 new interior = GetPlayerInterior(playerid);
  116.                 new vw = GetPlayerVirtualWorld(playerid);
  117.                 SetPlayerInterior(cpi[playerid],interior);
  118.                 SetPlayerVirtualWorld(cpi[playerid],vw);
  119.                 format(string,sizeof(string),"Succesfully teleported %s to you!",pName);
  120.                 ShowPlayerDialog(playerid,7,0,"Succes",string,"Ok","Back");
  121.             }
  122.         }
  123.     }
  124.     if(dialogid == 1)
  125.     {
  126.         if(response)
  127.         {
  128.             SendClientMessage(cpi[playerid],COLOR_RED,"|__________ Server Administration __________|");
  129.             SendClientMessage(cpi[playerid],COLOR_BLUE,"| You have been kicked from this server     |");
  130.             format(string,sizeof(string),"| Your name: %s",pName);
  131.             SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  132.             format(string,sizeof(string),"| Admin who kicked you: %s",aName);
  133.             SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  134.             format(string,sizeof(string),"| Reason: %s",inputtext);
  135.             SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  136.             SendClientMessage(cpi[playerid],COLOR_RED,"|___________________________________________|");
  137.             Kick(cpi[playerid]);
  138.             format(string,sizeof(string),"User %s kicked succesfully!",pName);
  139.             ShowPlayerDialog(playerid,7,0,"Succes",string,"Ok","Back");
  140.             format(string,sizeof(string),"** Player %s has been kicked by %s(Reason: %s)",pName,aName,inputtext);
  141.             SendClientMessageToAll(COLOR_YELLOW,string);
  142.         }
  143.     }
  144.     if(dialogid == 2)
  145.     {
  146.         if(response)
  147.         {
  148.             SendClientMessage(cpi[playerid],COLOR_RED,"___________ Server Administration ___________");
  149.             SendClientMessage(cpi[playerid],COLOR_BLUE,"| You have been banned from this server     |");
  150.             format(string,sizeof(string),"| Your name: %s",pName);
  151.             SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  152.             format(string,sizeof(string),"| Admin who banned you: %s",aName);
  153.             SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  154.             format(string,sizeof(string),"| Reason: %s",inputtext);
  155.             SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  156.             SendClientMessage(cpi[playerid],COLOR_BLUE,"| To appeal your ban, go to:                |");
  157.             format(string,sizeof(string),"%s",website);
  158.             SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  159.             SendClientMessage(cpi[playerid],COLOR_RED,"|___________________________________________|");
  160.             BanEx(cpi[playerid],inputtext);
  161.             format(string,sizeof(string),"User %s banned succesfully!",pName);
  162.             ShowPlayerDialog(playerid,7,0,"Succes",string,"Ok","Back");
  163.             format(string,sizeof(string),"** Player %s has been banned by %s(Reason: %s)",pName,aName,inputtext);
  164.             SendClientMessageToAll(COLOR_YELLOW,string);
  165.         }
  166.     }
  167.     if(dialogid == 3)
  168.     {
  169.         if(response)
  170.         {
  171.             warns[cpi[playerid]] = warns[cpi[playerid]]+1;
  172.             if(warns[cpi[playerid]] >= 3)
  173.             {
  174.                 SendClientMessage(cpi[playerid],COLOR_RED,"___________ Server Administration ___________");
  175.                 SendClientMessage(cpi[playerid],COLOR_BLUE,"| You have been kicked from this server    |");
  176.                 format(string,sizeof(string),"Your name: %s",pName);
  177.                 SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  178.                 format(string,sizeof(string),"Admin who kicked you: %s",aName);
  179.                 SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  180.                 format(string,sizeof(string),"Reason: %s (Reached 3 warnings)",inputtext);
  181.                 SendClientMessage(cpi[playerid],COLOR_BLUE,string);
  182.                 SendClientMessage(cpi[playerid],COLOR_RED,"|___________________________________________|");
  183.                 Kick(cpi[playerid]);
  184.                 format(string,sizeof(string),"User %s got auto-kicked for having 3 warnings!",pName);
  185.                 ShowPlayerDialog(playerid,7,0,"Succes",string,"Ok","Back");
  186.                 format(string,sizeof(string),"** Player %s has been auto-kicked for having 3 warnings (Reason: %s)",pName,inputtext);
  187.                 SendClientMessageToAll(COLOR_YELLOW,string);
  188.             }
  189.             else
  190.             {
  191.                 format(string,sizeof(string),"User %s warned succesfully!",pName);
  192.                 ShowPlayerDialog(playerid,7,0,"Succes",string,"Ok","Back");
  193.                 format(string,sizeof(string),"You have been by admin %s warned for:\n %s",aName,inputtext);
  194.                 ShowPlayerDialog(cpi[playerid],9,0,"Warned.",string,"Ok","Read Rules");
  195.             }
  196.         }
  197.     }
  198.            
  199.     if(dialogid == 7)
  200.     {
  201.         if(!response)
  202.         {
  203.             new listoptions[] = "1\tKick\n2\tBan\n3\tSlap\n4\tFreeze\n5\tUnfreeze\n6\tMute\n7\tUnmute\n8\tWarn\n9\tGoto\n10\tGethere";
  204.             ShowPlayerDialog(playerid,0,2,"Admin options",listoptions,"Continue","Cancel");
  205.         }
  206.     }
  207.     if(dialogid == 9)
  208.     {
  209.         if(!response) { Rules(playerid); }
  210.     }
  211.     return 1;
  212. }
  213.  
  214. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  215. {
  216.     if(IsPlayerAdmin(playerid))
  217.     {
  218.     new listoptions[] = "1\tKick\n2\tBan\n3\tSlap\n4\tFreeze\n5\tUnfreeze\n6\tMute\n7\tUnmute\n8\tWarn\n9\tGoto\n10\tGethere";
  219.     ShowPlayerDialog(playerid,0,2,"Admin options",listoptions,"Continue","Cancel");
  220.     cpi[playerid] = clickedplayerid;
  221.     }
  222.     return 1;
  223. }
Advertisement
Add Comment
Please, Sign In to add comment