Advertisement
Guest User

Untitled

a guest
Apr 1st, 2008
620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.49 KB | None | 0 0
  1.  /*-----------------------------------*\
  2.  ) Dragon Admin System - Dadmin        (
  3.  ) Modify All You Like For Your Server (
  4.  ) Do Not Re-Release Modded Version    (
  5.  \*-----------------------------------*/
  6.  
  7. #include <a_samp>
  8.  
  9. #define FILTERSCRIPT
  10. #if defined FILTERSCRIPT
  11.  
  12. #define green 0x33FF33AA
  13. #define red 0xFF0000AA
  14. #define yellow 0xFFFF00AA
  15. #define blue 0x2641FEAA
  16.  
  17. new AdminLvl[MAX_PLAYERS];
  18. new Wired[MAX_PLAYERS];
  19. new Jailed[MAX_PLAYERS];
  20.  
  21. public OnFilterScriptInit()
  22. {
  23.     print(" ---------------------------------------------------- ");
  24.     print("  Dragons admin system version one point five loaded  ");
  25.     print("  /Acmds for more information                         ");
  26.     print(" ---------------------------------------------------- ");
  27.     return 1;
  28. }
  29.  
  30. #endif
  31.  
  32. public OnPlayerConnect(playerid)
  33. {
  34.     AdminLvl[playerid] = 0;
  35.     Wired[playerid] = 0;
  36.     Jailed[playerid] = 0;
  37.     return 1;
  38. }
  39.  
  40. public OnPlayerDisconnect(playerid, reason)
  41. {
  42.     AdminLvl[playerid] = 0;
  43.     Wired[playerid] = 0;
  44.     Jailed[playerid] = 0;
  45.     return 1;
  46. }
  47.  
  48. public OnPlayerText(playerid, text[])
  49. {
  50.     if(Wired[playerid] == 0)
  51.     {
  52.         return 1;
  53.     }
  54.     else
  55.     {
  56.         return 0;
  57.     }
  58. }
  59.  
  60. public OnPlayerPrivmsg(playerid, recieverid, text[])
  61. {
  62.     new pname[26];
  63.     new oname[26];
  64.     new str[256];
  65.     GetPlayerName(playerid, pname, sizeof(pname));
  66.     GetPlayerName(recieverid, oname, sizeof(oname));
  67.     format(str, 256, "(( Message from %s to %s: %s ))", pname, oname, text[0]);
  68.     for(new i = 0; i < MAX_PLAYERS; i++)
  69.     {
  70.         if(IsPlayerConnected(i))
  71.         {
  72.             if(AdminLvl[i] == 1)
  73.             {
  74.                 SendClientMessage(i, green, str);
  75.             }
  76.         }
  77.     }
  78.     return 1;
  79. }
  80.  
  81. public OnPlayerCommandText(playerid, cmdtext[])
  82. {
  83.     if(Jailed[playerid] == 1) return SendClientMessage(playerid, red, "You can not use commands");
  84.    
  85.     new cmd[256], idx;
  86.     cmd = strtok(cmdtext, idx);
  87.     new id;
  88.     new tmp[256];
  89.     new pname[26];
  90.     new oname[26];
  91.     new string[100];
  92.     GetPlayerName(playerid, pname, sizeof(pname));
  93.    
  94.     if (strcmp("/acmds", cmdtext, true) == 0)
  95.     {
  96.         if(AdminLvl[playerid] == 1)
  97.         {
  98.             AdminLvl[playerid] = 0;
  99.             SendClientMessage(playerid, green, "/kick, /ban, /gmx, /freeze, /unfreeze");
  100.             SendClientMessage(playerid, green, "/goto, /gethere, /v, /ann, /explode, /a");
  101.             SendClientMessage(playerid, green, "/getall, /explodeall, /jail, /unjail");
  102.             SendClientMessage(playerid, green, "/wire, /unwire, /crash, /akill, /an");
  103.             SendClientMessage(playerid, green, "/disable, /reable");
  104.         }
  105.         else return SendClientMessage(playerid, red, "You are not an admin");
  106.         return 1;
  107.     }
  108.     if(!strcmp(cmd, "/admins", true))
  109.     {
  110.         SendClientMessage(playerid, green, "Admins online:");
  111.         for(new i = 0; i < MAX_PLAYERS; i++)
  112.         {
  113.             if(IsPlayerConnected(i))
  114.             {
  115.                 if(AdminLvl[i] == 1)
  116.                 {
  117.                     new str[256];
  118.                     new pnamep[24];
  119.                     GetPlayerName(i, pnamep, 24);
  120.                     format(str, 256, "Admin %s", pnamep);
  121.                     SendClientMessage(playerid, green, str);
  122.                 }
  123.             }
  124.         }
  125.         return 1;
  126.     }
  127.     if (strcmp("/alogin PASSWORD", cmdtext, true) == 0)
  128.     {
  129.         if(AdminLvl[playerid] == 1) return SendClientMessage(playerid, red, "You are already an admin");
  130.        
  131.         else if(AdminLvl[playerid] == 0)
  132.         {
  133.             AdminLvl[playerid] = 1;
  134.             SendClientMessage(playerid, yellow, "You have logged into admin");
  135.            
  136.             format(string, sizeof(string), "%s has loged into admin", pname);
  137.             printf(string);
  138.         }
  139.         return 1;
  140.     }
  141.     if (strcmp("/alogout", cmdtext, true) == 0)
  142.     {
  143.         if(AdminLvl[playerid] == 0) return SendClientMessage(playerid, red, "You are not an admin");
  144.  
  145.         else if(AdminLvl[playerid] == 1)
  146.         {
  147.             AdminLvl[playerid] = 0;
  148.             SendClientMessage(playerid, yellow, "You have logged out of admin");
  149.  
  150.             format(string, sizeof(string), "%s has logged out of admin", pname);
  151.             printf(string);
  152.         }
  153.         return 1;
  154.     }
  155.     if(!strcmp(cmd, "/ban", true))
  156.     {
  157.         if(AdminLvl[playerid] == 1)
  158.         {
  159.             tmp = strtok(cmdtext, idx);
  160.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  161.             id = strval(tmp);
  162.            
  163.             GetPlayerName(id, oname, sizeof(oname));
  164.             format(string, sizeof(string), "%s (%d) has been banned from the server by %s", oname, id, pname);
  165.             SendClientMessageToAll(red, string);
  166.             print(string);
  167.            
  168.             Ban(id);
  169.         }
  170.         else return SendClientMessage(playerid, red, "You are not an admin");
  171.         return 1;
  172.     }
  173.     if(!strcmp(cmd, "/kick", true))
  174.     {
  175.         if(AdminLvl[playerid] == 1)
  176.         {
  177.             tmp = strtok(cmdtext, idx);
  178.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  179.             id = strval(tmp);
  180.  
  181.             GetPlayerName(id, oname, sizeof(oname));
  182.             format(string, sizeof(string), "%s (%d) has been kicked from the server by %s", oname, id, pname);
  183.             SendClientMessageToAll(red, string);
  184.             print(string);
  185.  
  186.             Kick(id);
  187.         }
  188.         else return SendClientMessage(playerid, red, "You are not an admin");
  189.         return 1;
  190.     }
  191.     if(!strcmp(cmd, "/exit", true))
  192.     {
  193.         if(AdminLvl[playerid] == 1)
  194.         {
  195.             format(string, sizeof(string), "%s has shut down the server", pname);
  196.             SendClientMessageToAll(yellow, string);
  197.             print(string);
  198.            
  199.             SendRconCommand("exit");
  200.         }
  201.         else return SendClientMessage(playerid, red, "You are not an admin");
  202.         return 1;
  203.     }
  204.     if(!strcmp(cmd, "/gmx", true))
  205.     {
  206.         if(AdminLvl[playerid] == 1)
  207.         {
  208.             format(string, sizeof(string), "%s has restarted the server", pname);
  209.             SendClientMessageToAll(yellow, string);
  210.             print(string);
  211.            
  212.             SendRconCommand("gmx");
  213.         }
  214.         else return SendClientMessage(playerid, red, "You are not an admin");
  215.         return 1;
  216.     }
  217.     if(!strcmp(cmd, "/freeze", true))
  218.     {
  219.         if(AdminLvl[playerid] == 1)
  220.         {
  221.             tmp = strtok(cmdtext, idx);
  222.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  223.             id = strval(tmp);
  224.            
  225.             GetPlayerName(id, oname, sizeof(oname));
  226.             format(string, sizeof(string), "You have frozen %s (id %d)", oname, id);
  227.             SendClientMessage(playerid, yellow, string);
  228.            
  229.             SendClientMessage(id, yellow, "You have been frozen");
  230.             TogglePlayerControllable(id, 0);
  231.  
  232.             format(string, sizeof(string), "%s has frozen %s", pname, oname);
  233.             print(string);
  234.         }
  235.         else return SendClientMessage(playerid, red, "You are not an admin");
  236.         return 1;
  237.     }
  238.     if(!strcmp(cmd, "/unfreeze", true))
  239.     {
  240.         if(AdminLvl[playerid] == 1)
  241.         {
  242.             tmp = strtok(cmdtext, idx);
  243.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  244.             id = strval(tmp);
  245.  
  246.             GetPlayerName(id, oname, sizeof(oname));
  247.             format(string, sizeof(string), "You have frozen %s (id %d)", oname, id);
  248.             SendClientMessage(playerid, yellow, string);
  249.  
  250.             SendClientMessage(id, yellow, "You have been unfrozen");
  251.             TogglePlayerControllable(id, 1);
  252.  
  253.             format(string, sizeof(string), "%s has unfrozen %s", pname, oname);
  254.             print(string);
  255.         }
  256.         else return SendClientMessage(playerid, red, "You are not an admin");
  257.         return 1;
  258.     }
  259.     if(!strcmp(cmd, "/goto", true))
  260.     {
  261.         if(AdminLvl[playerid] == 1)
  262.         {
  263.             tmp = strtok(cmdtext, idx);
  264.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  265.             id = strval(tmp);
  266.  
  267.             new Float:x, Float:y, Float:z;
  268.             GetPlayerPos(id, x, y, z);
  269.             SetPlayerPos(playerid, x+1, y, z);
  270.  
  271.             GetPlayerName(id, oname, sizeof(oname));
  272.             format(string, sizeof(string), "You have teleported to %s (id %d)", oname, id);
  273.             SendClientMessage(playerid, yellow, string);
  274.  
  275.             format(string, sizeof(string), "%s has teleported to %s", pname, oname);
  276.             print(string);
  277.         }
  278.         else return SendClientMessage(playerid, red, "You are not an admin");
  279.         return 1;
  280.     }
  281.     if(!strcmp(cmd, "/gethere", true))
  282.     {
  283.         if(AdminLvl[playerid] == 1)
  284.         {
  285.             tmp = strtok(cmdtext, idx);
  286.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  287.             id = strval(tmp);
  288.  
  289.             new Float:x, Float:y, Float:z;
  290.             GetPlayerPos(playerid, x, y, z);
  291.             SetPlayerPos(id, x+1, y, z);
  292.  
  293.             GetPlayerName(id, oname, sizeof(oname));
  294.             format(string, sizeof(string), "You have teleported %s (id %d) to you", oname, id);
  295.             SendClientMessage(playerid, yellow, string);
  296.            
  297.             SendClientMessage(id, yellow, "You have been teleported to an admin");
  298.  
  299.             format(string, sizeof(string), "%s has teleported %s to him", pname, oname);
  300.             print(string);
  301.         }
  302.         else return SendClientMessage(playerid, red, "You are not an admin");
  303.         return 1;
  304.     }
  305.     if(!strcmp(cmd, "/v", true))
  306.     {
  307.         if(AdminLvl[playerid] == 1)
  308.         {
  309.             new carid, color1, color2;
  310.             tmp = strtok(cmdtext, idx);
  311.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in any ids");
  312.  
  313.             carid = strval(tmp);
  314.             if(carid < 400 || carid > 611) return SendClientMessage(playerid, red, "Only vehicle ids above 400 and below 611 are valid");
  315.  
  316.             tmp = strtok(cmdtext, idx);
  317.             color1 = strval(tmp);
  318.             if(color1 < 0 || color1 > 126) return SendClientMessage(playerid, red, "Only color ids 0 and below 126 are valid");
  319.  
  320.             tmp = strtok(cmdtext, idx);
  321.             color2 = strval(tmp);
  322.             if(color1 < 0 || color1 > 126) return SendClientMessage(playerid, red, "Only color ids 0 and below 126 are valid");
  323.  
  324.             new Float:X, Float:Y, Float:Z;
  325.             GetPlayerPos(playerid, X, Y, Z);
  326.             CreateVehicle(carid, X+3, Y, Z, 0 , color1, color2, 0);
  327.  
  328.             format(string, sizeof(string), "%s has spawned a car with id %d", pname, carid);
  329.             print(string);
  330.         }
  331.         else return SendClientMessage(playerid, red, "You are not an admin");
  332.         return 1;
  333.     }
  334.     if(!strcmp(cmd, "/ann", true))
  335.     {
  336.         if(AdminLvl[playerid] == 1)
  337.         {
  338.             tmp = strtok(cmdtext, idx);
  339.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't type anything");
  340.             id = strval(tmp);
  341.  
  342.             format(string, 256, "%s", cmdtext[5]);
  343.             GameTextForAll(string, 5000, 5);
  344.  
  345.             format(string, sizeof(string), "%s has announced: %s", pname, cmdtext[5]);
  346.             print(string);
  347.         }
  348.         else return SendClientMessage(playerid, red, "You are not an admin");
  349.         return 1;
  350.     }
  351.     if(!strcmp(cmd, "/explode", true))
  352.     {
  353.         if(AdminLvl[playerid] == 1)
  354.         {
  355.             tmp = strtok(cmdtext, idx);
  356.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  357.             id = strval(tmp);
  358.  
  359.             new Float:x, Float:y, Float:z;
  360.             GetPlayerPos(id, x, y, z);
  361.             CreateExplosion(x, y, z, 7, 200);
  362.  
  363.             GetPlayerName(id, oname, sizeof(oname));
  364.             format(string, sizeof(string), "You exploded %s (id: %d)", oname, id);
  365.             SendClientMessage(playerid, yellow, string);
  366.  
  367.             SendClientMessage(id, yellow, "You have been exploded");
  368.  
  369.             format(string, sizeof(string), "%s has exploded %s", pname, oname);
  370.             print(string);
  371.         }
  372.         else return SendClientMessage(playerid, red, "You are not an admin");
  373.         return 1;
  374.     }
  375.     if(!strcmp(cmd, "/a", true))
  376.     {
  377.         if(AdminLvl[playerid] == 1)
  378.         {
  379.             for(new i = 0; i < MAX_PLAYERS; i++)
  380.             {
  381.                 if(IsPlayerConnected(i))
  382.                 {
  383.                     if(AdminLvl[i] == 1)
  384.                     {
  385.                         new str[256];
  386.                         format(str, 256, "(( Admin %s: %s ))", pname, cmdtext[3]);
  387.                         SendClientMessage(i, green, str);
  388.                     }
  389.                 }
  390.             }
  391.         }
  392.         else return SendClientMessage(playerid, red, "You are not an admin");
  393.         return 1;
  394.     }
  395.     if(!strcmp(cmd, "/getall", true))
  396.     {
  397.         if(AdminLvl[playerid] == 1)
  398.         {
  399.             new Float:x, Float:y, Float:z;
  400.             GetPlayerPos(playerid, x, y, z);
  401.  
  402.             for(new i = 0; i < MAX_PLAYERS; i++)
  403.             SetPlayerPos(i, x, y, z);
  404.  
  405.             format(string, sizeof(string), "%s has teleported everyone to him", pname);
  406.             SendClientMessageToAll(yellow, string);
  407.             print(string);
  408.         }
  409.         else return SendClientMessage(playerid, red, "You are not an admin");
  410.         return 1;
  411.     }
  412.     if(!strcmp(cmd, "/explodeall", true))
  413.     {
  414.         if(AdminLvl[playerid] == 1)
  415.         {
  416.             format(string, sizeof(string), "%s has blown up everyone", pname);
  417.             SendClientMessageToAll(yellow, string);
  418.             print(string);
  419.            
  420.             new Float:x, Float:y, Float:z;
  421.             for(new i = 0; i < MAX_PLAYERS; i++)
  422.             {
  423.                 GetPlayerPos(i, x, y, z);
  424.                 CreateExplosion(x, y, z, 7, 200);
  425.             }
  426.         }
  427.         else return SendClientMessage(playerid, red, "You are not an admin");
  428.         return 1;
  429.     }
  430.     if(!strcmp(cmd, "/jail", true))
  431.     {
  432.         if(AdminLvl[playerid] == 1)
  433.         {
  434.             tmp = strtok(cmdtext, idx);
  435.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  436.             id = strval(tmp);
  437.  
  438.             Jailed[id] = 1;
  439.             SetPlayerInterior(id, 3);
  440.             SetPlayerPos(id, 197.6661, 173.8179, 1003.0234);
  441.  
  442.             GetPlayerName(id, oname, sizeof(oname));
  443.             format(string, sizeof(string), "You have jailed %s (id: %d)", oname, id);
  444.             SendClientMessage(playerid, yellow, string);
  445.            
  446.             SendClientMessage(id, yellow, "You have been jailed");
  447.            
  448.             format(string, sizeof(string), "%s has been jailed by %s", oname, pname);
  449.             print(string);
  450.         }
  451.         else return SendClientMessage(playerid, red, "You are not an admin");
  452.         return 1;
  453.     }
  454.     if(!strcmp(cmd, "/unjail", true))
  455.     {
  456.         if(AdminLvl[playerid] == 1)
  457.         {
  458.             tmp = strtok(cmdtext, idx);
  459.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  460.             id = strval(tmp);
  461.            
  462.             Jailed[id] = 0;
  463.             SetPlayerHealth(id, 0);
  464.             SendClientMessage(id, yellow, "You have been unjailed");
  465.  
  466.             GetPlayerName(id, oname, sizeof(oname));
  467.             format(string, sizeof(string), "You have unjailed %s (id: %d)", oname, id);
  468.             SendClientMessage(playerid, yellow, string);
  469.  
  470.             format(string, sizeof(string), "%s has been unjailed by %s", oname, pname);
  471.             print(string);
  472.         }
  473.         else return SendClientMessage(playerid, red, "You are not an admin");
  474.         return 1;
  475.     }
  476.     if(!strcmp(cmd, "/wire", true))
  477.     {
  478.         if(AdminLvl[playerid] == 1)
  479.         {
  480.             tmp = strtok(cmdtext, idx);
  481.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  482.             id = strval(tmp);
  483.  
  484.             Wired[id] = 1;
  485.  
  486.             GetPlayerName(id, oname, sizeof(oname));
  487.             format(string, sizeof(string), "You have wired %s (id: %d)", oname, id);
  488.             SendClientMessage(playerid, yellow, string);
  489.  
  490.             SendClientMessage(id, yellow, "You have been wired");
  491.  
  492.             GetPlayerName(id, oname, sizeof(oname));
  493.             format(string, sizeof(string), "%s has been wired by %s", oname, pname);
  494.             print(string);
  495.         }
  496.         else return SendClientMessage(playerid, red, "You are not an admin");
  497.         return 1;
  498.     }
  499.     if(!strcmp(cmd, "/unwire", true))
  500.     {
  501.         if(AdminLvl[playerid] == 1)
  502.         {
  503.             tmp = strtok(cmdtext, idx);
  504.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  505.             id = strval(tmp);
  506.  
  507.             Wired[id] = 0;
  508.  
  509.             GetPlayerName(id, oname, sizeof(oname));
  510.             format(string, sizeof(string), "You have unwired %s (id: %d)", oname, id);
  511.             SendClientMessage(playerid, yellow, string);
  512.            
  513.             SendClientMessage(id, yellow, "You have been unwired");
  514.  
  515.             GetPlayerName(id, oname, sizeof(oname));
  516.             format(string, sizeof(string), "%s has been unwired by %s", oname, pname);
  517.             print(string);
  518.         }
  519.         else return SendClientMessage(playerid, red, "You are not an admin");
  520.         return 1;
  521.     }
  522.     if(!strcmp(cmd, "/crash", true))
  523.     {
  524.         if(AdminLvl[playerid] == 1)
  525.         {
  526.             tmp = strtok(cmdtext, idx);
  527.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  528.             id = strval(tmp);
  529.  
  530.             Wired[id] = 0;
  531.  
  532.             GetPlayerName(id, oname, sizeof(oname));
  533.             format(string, sizeof(string), "You have crashed %s (id: %d)", oname, id);
  534.             SendClientMessage(playerid, yellow, string);
  535.  
  536.             GameTextForPlayer(id, "~n~~", 4000, 3);
  537.  
  538.             GetPlayerName(id, oname, sizeof(oname));
  539.             format(string, sizeof(string), "%s has crashed %s", pname, oname);
  540.             print(string);
  541.         }
  542.         else return SendClientMessage(playerid, red, "You are not an admin");
  543.         return 1;
  544.     }
  545.     if(!strcmp(cmd, "/akill", true))
  546.     {
  547.         if(AdminLvl[playerid] == 1)
  548.         {
  549.             tmp = strtok(cmdtext, idx);
  550.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  551.             id = strval(tmp);
  552.  
  553.             Wired[id] = 0;
  554.  
  555.             GetPlayerName(id, oname, sizeof(oname));
  556.             format(string, sizeof(string), "You have killed %s (id: %d)", oname, id);
  557.             SendClientMessage(playerid, yellow, string);
  558.  
  559.             SendClientMessage(id, yellow, "You have been auto killed");
  560.             SetPlayerHealth(id, 0);
  561.  
  562.             GetPlayerName(id, oname, sizeof(oname));
  563.             format(string, sizeof(string), "%s has auto killed %s", pname, oname);
  564.             print(string);
  565.         }
  566.         else return SendClientMessage(playerid, red, "You are not an admin");
  567.         return 1;
  568.     }
  569.     if(!strcmp(cmd, "/an", true))
  570.     {
  571.         if(AdminLvl[playerid] == 1)
  572.         {
  573.             tmp = strtok(cmdtext, idx);
  574.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't type anything");
  575.             id = strval(tmp);
  576.  
  577.             format(string, 256, "Admin: %s", cmdtext[4]);
  578.             SendClientMessageToAll(blue, string);
  579.  
  580.             format(string, sizeof(string), "%s has admin announced: %s", pname, cmdtext[4]);
  581.             print(string);
  582.         }
  583.         else return SendClientMessage(playerid, red, "You are not an admin");
  584.         return 1;
  585.     }
  586.     if(!strcmp(cmd, "/disable", true))
  587.     {
  588.         if(AdminLvl[playerid] == 1)
  589.         {
  590.             tmp = strtok(cmdtext, idx);
  591.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  592.             id = strval(tmp);
  593.  
  594.             SendClientMessage(id, yellow, "Your commands have been disabled");
  595.             Jailed[id] = 1;
  596.  
  597.             GetPlayerName(id, oname, sizeof(oname));
  598.             format(string, sizeof(string), "You have disabled %s's commands (id: %d)", oname, id);
  599.             SendClientMessage(playerid, yellow, string);
  600.  
  601.             GetPlayerName(id, oname, sizeof(oname));
  602.             format(string, sizeof(string), "%s has disabled %s's commands", pname, oname);
  603.             print(string);
  604.         }
  605.         else return SendClientMessage(playerid, red, "You are not an admin");
  606.         return 1;
  607.     }
  608.     if(!strcmp(cmd, "/reable", true))
  609.     {
  610.         if(AdminLvl[playerid] == 1)
  611.         {
  612.             tmp = strtok(cmdtext, idx);
  613.             if(!strlen(tmp)) return SendClientMessage(playerid, red, "You didn't put in an id");
  614.             id = strval(tmp);
  615.            
  616.             SendClientMessage(id, yellow, "Your commands have been reabled");
  617.             Jailed[id] = 0;
  618.  
  619.             GetPlayerName(id, oname, sizeof(oname));
  620.             format(string, sizeof(string), "You have reabled %s's commands (id: %d)", oname, id);
  621.             SendClientMessage(playerid, yellow, string);
  622.  
  623.             GetPlayerName(id, oname, sizeof(oname));
  624.             format(string, sizeof(string), "%s has reabled %s's commands", pname, oname);
  625.             print(string);
  626.         }
  627.         else return SendClientMessage(playerid, red, "You are not an admin");
  628.         return 1;
  629.     }
  630.     return 0;
  631. }
  632.  
  633. strtok(const string[], &index)
  634. {
  635.     new length = strlen(string);
  636.     while ((index < length) && (string[index] <= ' '))
  637.     {
  638.         index++;
  639.     }
  640.  
  641.     new offset = index;
  642.     new result[20];
  643.     while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  644.     {
  645.         result[index - offset] = string[index];
  646.         index++;
  647.     }
  648.     result[index - offset] = EOS;
  649.     return result;
  650. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement