Advertisement
Guest User

Zezombia

a guest
Nov 11th, 2008
2,307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 27.05 KB | None | 0 0
  1. //-----
  2. // Credits...
  3. // iAdmin created by Zezombia (Nov 11 2008)
  4. // Jacob - IRC Plugin and Include
  5. // Grove/Jay - Players command
  6. // ThePro - Crash command help
  7. // Xtreme - Jail cords
  8. // Andre9977 - Basic help
  9. //-----
  10.  
  11. //--CONFIG--[EDIT THIS]-----------------------------
  12.  
  13. #define EchoBot "iAdmin" //your bots name
  14. #define EchoServer "irc.gamesurge.net" //irc hoster
  15. #define EchoChan "#SA-FE" //server channel
  16. #define EchoPort 6667 //this port is used by default
  17. #define CmdChar '!' //used for commands, as in !ikick
  18.  
  19. //--CONFIG--END--[NO NEED TO EDIT PAST THIS POINT]--
  20.  
  21. #include <a_samp>
  22. #include <a_irc>
  23.  
  24. #pragma unused sztmp
  25.  
  26. #define yellow 0xFFFF00AA
  27. #define red 0xFF0000AA
  28. #define white 0xFFFFFFFF
  29.  
  30. forward ircOnConnect(conn);
  31. forward ircOnUserSay(conn, channel[], user[], message[]);
  32. forward ircOnUserPart(conn, channel[], user[]);
  33. forward ircOnUserJoin(conn, channel[], user[]);
  34.  
  35. forward EventTimer(); //do not remove
  36.  
  37. forward ircConn();
  38. forward ircJoin(conn);
  39.  
  40. new EchoConnection;
  41.  
  42. new wire[MAX_PLAYERS];
  43. new jail[MAX_PLAYERS];
  44.  
  45. //connection crap
  46.  
  47. public OnFilterScriptInit()
  48. {
  49.     SetTimer("ircConn", 10000, 0);
  50.     SetTimer("EventTimer", 500, 1);
  51.     return 1;
  52. }
  53.  
  54. public OnFilterScriptExit()
  55. {
  56.     ircDisconnect(EchoConnection);
  57.     return 1;
  58. }
  59.  
  60. public ircOnConnect(conn)
  61. {
  62.     SetTimerEx("ircJoin", 10000, 0, "i", conn);
  63.     return 1;
  64. }
  65.  
  66. public ircConn()
  67. {
  68.     new string[100];
  69.     format(string, sizeof(string), "a%d", random(50));
  70.     EchoConnection = ircConnect(EchoServer, EchoPort, string);
  71.     return 1;
  72. }
  73.  
  74. public ircJoin(conn)
  75. {
  76.     new string[256];
  77.     ircJoinChan(conn, EchoChan);
  78.     format(string, sizeof(string), "nick %s", EchoBot);
  79.     ircSendRawData(conn, string);
  80.     return 1;
  81. }
  82.  
  83. public EventTimer()
  84. {
  85.     ircPollEvents();
  86.     return 1;
  87. }
  88.  
  89. //connection crap end
  90.  
  91. //irc crap
  92.  
  93. public ircOnUserSay(conn, channel[], user[], message[])
  94. {
  95.     new string[256];
  96.     format(string, sizeof(string), "[IRC]%s: %s", user, message);
  97.     SendClientMessageToAll(white, string);
  98.    
  99.     if(message[0] == CmdChar)
  100.     {
  101.         irccmd(ikick, 5, conn, channel, user, message);
  102.         irccmd(crash, 5, conn, channel, user, message);
  103.         irccmd(iban, 4, conn, channel, user, message);
  104.         irccmd(rangeban, 8, conn, channel, user, message);
  105.         irccmd(wire, 4, conn, channel, user, message);
  106.         irccmd(unwire, 6, conn, channel, user, message);
  107.         irccmd(ann, 3, conn, channel, user, message);
  108.         irccmd(getinfo, 7, conn, channel, user, message);
  109.         irccmd(jail, 4, conn, channel, user, message);
  110.         irccmd(unjail, 6, conn, channel, user, message);
  111.         irccmd(getid, 5, conn, channel, user, message);
  112.         irccmd(gmx, 3, conn, channel, user, message);
  113.         irccmd(clearchat, 9, conn, channel, user, message);
  114.         irccmd(slap, 4, conn, channel, user, message);
  115.         irccmd(freeze, 6, conn, channel, user, message);
  116.         irccmd(unfreeze, 8, conn, channel, user, message);
  117.         irccmd(tele, 4, conn, channel, user, message);
  118.         irccmd(eject, 5, conn, channel, user, message);
  119.         irccmd(sethealth, 9, conn, channel, user, message);
  120.         irccmd(disarm, 6, conn, channel, user, message);
  121.         irccmd(explode, 7, conn, channel, user, message);
  122.         irccmd(givemoney, 9, conn, channel, user, message);
  123.         irccmd(setscore, 8, conn, channel, user, message);
  124.         irccmd(setname, 7, conn, channel, user, message);
  125.         irccmd(akill, 5, conn, channel, user, message);
  126.         irccmd(giveweapon, 10, conn, channel, user, message);
  127.         irccmd(players, 7, conn, channel, user, message);
  128.     }
  129.     return 1;
  130. }
  131.  
  132. //end of irc crap
  133.  
  134. //commands
  135.  
  136. irccmd_ikick(conn, channel[], user[], message[])
  137. {
  138.     new tmp[256];
  139.     tmp = zcmd(1, message);
  140.    
  141.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  142.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  143.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  144.  
  145.     new oname[MAX_PLAYER_NAME];
  146.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  147.  
  148.     new string[256];
  149.     format(string, sizeof(string), "\"%s\" has been kicked from the game by IRC admin \"%s\"", oname, user);
  150.  
  151.     SendClientMessageToAll(yellow, string);
  152.     ircSay(conn, channel, string);
  153.    
  154.     Kick(strval(tmp));
  155.     return 1;
  156. }
  157.  
  158. irccmd_crash(conn, channel[], user[], message[])
  159. {
  160.     new tmp[256];
  161.     tmp = zcmd(1, message);
  162.  
  163.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  164.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  165.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  166.  
  167.     new oname[MAX_PLAYER_NAME];
  168.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  169.  
  170.     new string[256];
  171.     format(string, sizeof(string), "\"%s\" has been crashed from the game by IRC admin \"%s\"", oname, user);
  172.  
  173.     SendClientMessageToAll(yellow, string);
  174.     ircSay(conn, channel, string);
  175.  
  176.     new Float:X, Float:Y, Float:Z;
  177.     GetPlayerPos(strval(tmp), X, Y, Z);
  178.  
  179.     new objectcrash = CreatePlayerObject(strval(tmp), 11111111, X, Y, Z, 0, 0, 0); // credits to ThePro
  180.     DestroyObject(objectcrash);
  181.     return 1;
  182. }
  183.  
  184. irccmd_iban(conn, channel[], user[], message[])
  185. {
  186.     new tmp[256];
  187.     tmp = zcmd(1, message);
  188.  
  189.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  190.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  191.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  192.  
  193.     new oname[MAX_PLAYER_NAME];
  194.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  195.  
  196.     new string[256];
  197.     format(string, sizeof(string), "\"%s\" has been banned from the game by IRC admin \"%s\"", oname, user);
  198.  
  199.     SendClientMessageToAll(yellow, string);
  200.     ircSay(conn, channel, string);
  201.  
  202.     Ban(strval(tmp));
  203.     return 1;
  204. }
  205.  
  206. irccmd_rangeban(conn, channel[], user[], message[])
  207. {
  208.     new tmp[256];
  209.     tmp = zcmd(1, message);
  210.  
  211.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  212.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  213.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  214.  
  215.     new oname[MAX_PLAYER_NAME];
  216.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  217.  
  218.     new string[256];
  219.     format(string, sizeof(string), "\"%s\" has been range banned from the game by IRC admin \"%s\"", oname, user);
  220.  
  221.     SendClientMessageToAll(yellow, string);
  222.     ircSay(conn, channel, string);
  223.  
  224.     RangeBan(strval(tmp));
  225.     return 1;
  226. }
  227.  
  228. irccmd_wire(conn, channel[], user[], message[])
  229. {
  230.     new tmp[256];
  231.     tmp = zcmd(1, message);
  232.  
  233.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  234.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  235.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  236.  
  237.     new oname[MAX_PLAYER_NAME];
  238.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  239.  
  240.     wire[strval(tmp)] == 1;
  241.  
  242.     new string[256];
  243.     format(string, sizeof(string), "\"%s\" has been wired by admin \"%s\"", oname, user);
  244.    
  245.     SendClientMessageToAll(yellow, string);
  246.     ircSay(conn, channel, string);
  247.     return 1;
  248. }
  249.  
  250. irccmd_unwire(conn, channel[], user[], message[])
  251. {
  252.     new tmp[256];
  253.     tmp = zcmd(1, message);
  254.  
  255.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  256.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  257.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  258.  
  259.     new oname[MAX_PLAYER_NAME];
  260.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  261.  
  262.     wire[strval(tmp)] == 0;
  263.  
  264.     new string[256];
  265.     format(string, sizeof(string), "\"%s\" has been unwired by admin \"%s\"", oname, user);
  266.  
  267.     SendClientMessageToAll(yellow, string);
  268.     ircSay(conn, channel, string);
  269.     return 1;
  270. }
  271.  
  272. irccmd_ann(conn, channel[], user[], message[])
  273. {
  274.     new tmp[256];
  275.     tmp = zcmd(1, message);
  276.  
  277.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  278.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in a msg");
  279.  
  280.     new string[256];
  281.     format(string, sizeof(string), "%s", message[6]);
  282.     GameTextForAll(string, 5000, 3);
  283.     return 1;
  284. }
  285.  
  286. irccmd_getinfo(conn, channel[], user[], message[])
  287. {
  288.     new tmp[256];
  289.     tmp = zcmd(1, message);
  290.  
  291.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  292.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  293.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  294.  
  295.     new oname[MAX_PLAYER_NAME];
  296.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  297.  
  298.     new string[256];
  299.  
  300.     format(string, sizeof(string), "Name: %s", oname);
  301.     ircSay(conn, channel, string);
  302.  
  303.     format(string, sizeof(string), "ID: %d", strval(tmp));
  304.     ircSay(conn, channel, string);
  305.  
  306.     format(string, sizeof(string), "Cash: %d", GetPlayerMoney(strval(tmp)));
  307.     ircSay(conn, channel, string);
  308.  
  309.     format(string, sizeof(string), "Score: %d", GetPlayerScore(strval(tmp)));
  310.     ircSay(conn, channel, string);
  311.     return 1;
  312. }
  313.  
  314. irccmd_jail(conn, channel[], user[], message[])
  315. {
  316.     new tmp[256];
  317.     tmp = zcmd(1, message);
  318.  
  319.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  320.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  321.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  322.  
  323.     new oname[MAX_PLAYER_NAME];
  324.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  325.  
  326.     jail[strval(tmp)] = 1;
  327.  
  328.     TeleportPlayer(strval(tmp), 197.6661,173.8179,1003.0234, 0, 3); //location credits to XtremeAdmin2
  329.     SetPlayerHealth(strval(tmp), 100);
  330.    
  331.     new string[256];
  332.     format(string, sizeof(string), "\"%s\" has been jailed by admin \"%s\"", oname, user);
  333.    
  334.     SendClientMessageToAll(yellow, string);
  335.     ircSay(conn, channel, string);
  336.     return 1;
  337. }
  338.  
  339. irccmd_unjail(conn, channel[], user[], message[])
  340. {
  341.     new tmp[256];
  342.     tmp = zcmd(1, message);
  343.  
  344.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  345.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  346.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  347.  
  348.     new oname[MAX_PLAYER_NAME];
  349.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  350.  
  351.     jail[strval(tmp)] = 0;
  352.  
  353.     SetPlayerHealth(strval(tmp), 0);
  354.  
  355.     new string[256];
  356.     format(string, sizeof(string), "\"%s\" has been unjailed by admin \"%s\"", oname, user);
  357.  
  358.     SendClientMessageToAll(yellow, string);
  359.     ircSay(conn, channel, string);
  360.     return 1;
  361. }
  362.  
  363. irccmd_getid(conn, channel[], user[], message[])
  364. {
  365.     new tmp[256], id;
  366.     tmp = zcmd(1, message);
  367.    
  368.     id = GetPlayerIDFromName(tmp);
  369.  
  370.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  371.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not give a name");
  372.     if(id == -1) return ircSay(conn, channel, "That player name was not found");
  373.  
  374.     new pname[MAX_PLAYER_NAME];
  375.     GetPlayerName(strval(tmp), pname, sizeof(pname));
  376.  
  377.     new string[256];
  378.     format(string, sizeof(string), "%s: %d", pname, id);
  379.  
  380.     ircSay(conn, channel, string);
  381.     return 1;
  382. }
  383.  
  384. irccmd_gmx(conn, channel[], user[], message[])
  385. {
  386.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  387.  
  388.     new string[256];
  389.     format(string, sizeof(string), "IRC admin \"%s\" has done a /GMX (server restart)", user);
  390.  
  391.     SendClientMessageToAll(yellow, string);
  392.     ircSay(conn, channel, string);
  393.    
  394.     #pragma unused message
  395.     return 1;
  396. }
  397.  
  398. irccmd_clearchat(conn, channel[], user[], message[])
  399. {
  400.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  401.  
  402.     new string[256];
  403.     format(string, sizeof(string), "IRC admin \"%s\" has cleared the chat", user);
  404.  
  405.     SendClientMessageToAll(yellow, string);
  406.     ircSay(conn, channel, string);
  407.  
  408.     #pragma unused message
  409.     return 1;
  410. }
  411.  
  412. irccmd_slap(conn, channel[], user[], message[])
  413. {
  414.     new tmp[256];
  415.     tmp = zcmd(1, message);
  416.  
  417.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  418.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  419.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  420.  
  421.     new Float:x, Float:y, Float:z;
  422.     GetPlayerPos(strval(tmp), x, y, z);
  423.     SetPlayerPos(strval(tmp), x, y, z + 10);
  424.  
  425.     new oname[MAX_PLAYER_NAME];
  426.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  427.  
  428.     new string[256];
  429.     format(string, sizeof(string), "\"%s\" has been slapped by IRC admin \"%s\"", oname, user);
  430.    
  431.     SendClientMessageToAll(yellow, string);
  432.     ircSay(conn, channel, string);
  433.     return 1;
  434. }
  435.  
  436. irccmd_freeze(conn, channel[], user[], message[])
  437. {
  438.     new tmp[256];
  439.     tmp = zcmd(1, message);
  440.  
  441.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  442.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  443.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  444.  
  445.     TogglePlayerControllable(strval(tmp), 0);
  446.  
  447.     new oname[MAX_PLAYER_NAME];
  448.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  449.  
  450.     new string[256];
  451.     format(string, sizeof(string), "\"%s\" has been frozen by IRC admin \"%s\"", oname, user);
  452.  
  453.     SendClientMessageToAll(yellow, string);
  454.     ircSay(conn, channel, string);
  455.     return 1;
  456. }
  457.  
  458. irccmd_unfreeze(conn, channel[], user[], message[])
  459. {
  460.     new tmp[256];
  461.     tmp = zcmd(1, message);
  462.  
  463.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  464.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  465.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  466.  
  467.     TogglePlayerControllable(strval(tmp), 0);
  468.  
  469.     new oname[MAX_PLAYER_NAME];
  470.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  471.  
  472.     new string[256];
  473.     format(string, sizeof(string), "\"%s\" has been unfrozen by IRC admin \"%s\"", oname, user);
  474.  
  475.     SendClientMessageToAll(yellow, string);
  476.     ircSay(conn, channel, string);
  477.     return 1;
  478. }
  479.  
  480. irccmd_tele(conn, channel[], user[], message[])
  481. {
  482.     new tmp[256], tmp2[256];
  483.     tmp = zcmd(1, message);
  484.     tmp2 = zcmd(2, message);
  485.  
  486.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  487.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in the first id");
  488.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "The first player is not connected");
  489.     if(strlen(tmp2) == 0) return ircSay(conn, channel, "You did not put in the second id");
  490.     if(IsPlayerConnected(strval(tmp2)) == 0) return ircSay(conn, channel, "The second player is not connected");
  491.  
  492.     new Float:X, Float:Y, Float:Z;
  493.     GetPlayerPos(strval(tmp2), X, Y, Z);
  494.     Teleport(strval(tmp), X, Y, Z + 2, random(360), GetPlayerInterior(strval(tmp2)));
  495.  
  496.     new oname[MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
  497.     GetPlayerName(strval(tmp), pname, sizeof(pname));
  498.     GetPlayerName(strval(tmp2), oname, sizeof(oname));
  499.  
  500.     new string[256];
  501.     format(string, sizeof(string), "\"%s\" has been teled to \"%s\" by IRC admin \"%s\"", pname, oname, user);
  502.  
  503.     SendClientMessageToAll(yellow, string);
  504.     ircSay(conn, channel, string);
  505.     return 1;
  506. }
  507.  
  508. irccmd_eject(conn, channel[], user[], message[])
  509. {
  510.     new tmp[256];
  511.     tmp = zcmd(1, message);
  512.  
  513.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  514.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  515.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  516.  
  517.     RemovePlayerFromVehicle(strval(tmp));
  518.    
  519.     new oname[MAX_PLAYER_NAME];
  520.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  521.    
  522.     new string[256];
  523.     format(string, sizeof(string), "\"%s\" has been ejected by IRC admin \"%s\"", oname, user);
  524.  
  525.     SendClientMessageToAll(yellow, string);
  526.     ircSay(conn, channel, string);
  527.     return 1;
  528. }
  529.  
  530. irccmd_sethealth(conn, channel[], user[], message[])
  531. {
  532.     new tmp[256], tmp2[256], Float:health;
  533.     tmp = zcmd(1, message);
  534.     tmp2 = zcmd(2, message);
  535.  
  536.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  537.     if(strlen(tmp) == 0) return ircSay(conn, channel, "Use: /sethealth [ID] [HEALTH]");
  538.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  539.     if(strlen(tmp2) == 0) return ircSay(conn, channel, "Use: /sethealth [ID] [HEALTH]");
  540.  
  541.     health = strval(tmp2);
  542.  
  543.     SetPlayerHealth(strval(tmp), health);
  544.  
  545.     new oname[MAX_PLAYER_NAME];
  546.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  547.  
  548.     new string[256];
  549.     format(string, sizeof(string), "\"%s\" has had his health set to \"%0.0f\" by IRC admin \"%s\"", oname, health, user);
  550.  
  551.     SendClientMessageToAll(yellow, string);
  552.     ircSay(conn, channel, string);
  553.     return 1;
  554. }
  555.  
  556. irccmd_disarm(conn, channel[], user[], message[])
  557. {
  558.     new tmp[256];
  559.     tmp = zcmd(1, message);
  560.  
  561.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  562.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  563.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  564.  
  565.     ResetPlayerWeapons(strval(tmp));
  566.  
  567.     new oname[MAX_PLAYER_NAME];
  568.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  569.  
  570.     new string[256];
  571.     format(string, sizeof(string), "\"%s\" has had his weapons reset by IRC admin \"%s\"", oname, user);
  572.  
  573.     SendClientMessageToAll(yellow, string);
  574.     ircSay(conn, channel, string);
  575.     return 1;
  576. }
  577.  
  578. irccmd_explode(conn, channel[], user[], message[])
  579. {
  580.     new tmp[256];
  581.     tmp = zcmd(1, message);
  582.  
  583.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  584.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  585.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  586.  
  587.     new Float:x, Float:y, Float:z;
  588.     GetPlayerPos(strval(tmp), x, y, z);
  589.     CreateExplosion(x, y, z, 10, 0);
  590.  
  591.     new oname[MAX_PLAYER_NAME];
  592.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  593.  
  594.     new string[256];
  595.     format(string, sizeof(string), "\"%s\" has been exploded by IRC admin \"%s\"", oname, user);
  596.  
  597.     SendClientMessageToAll(yellow, string);
  598.     ircSay(conn, channel, string);
  599.     return 1;
  600. }
  601.  
  602. irccmd_givemoney(conn, channel[], user[], message[])
  603. {
  604.     new tmp[256], tmp2[256];
  605.     tmp = zcmd(1, message);
  606.     tmp2 = zcmd(2, message);
  607.  
  608.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  609.     if(strlen(tmp) == 0) return ircSay(conn, channel, "Use: /givemoney [ID] [AMMOUNT]");
  610.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  611.     if(strlen(tmp2) == 0) return ircSay(conn, channel, "Use: /givemoney [ID] [AMMOUNT]");
  612.  
  613.     GivePlayerMoney(strval(tmp), strval(tmp2));
  614.  
  615.     new oname[MAX_PLAYER_NAME];
  616.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  617.  
  618.     new string[256];
  619.     format(string, sizeof(string), "\"%s\" has been given $%d by IRC admin \"%s\"", oname, strval(tmp2), user);
  620.  
  621.     SendClientMessageToAll(yellow, string);
  622.     ircSay(conn, channel, string);
  623.     return 1;
  624. }
  625.  
  626. irccmd_setscore(conn, channel[], user[], message[])
  627. {
  628.     new tmp[256], tmp2[256];
  629.     tmp = zcmd(1, message);
  630.     tmp2 = zcmd(2, message);
  631.  
  632.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  633.     if(strlen(tmp) == 0) return ircSay(conn, channel, "Use: /setscore [ID] [AMMOUNT]");
  634.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  635.     if(strlen(tmp2) == 0) return ircSay(conn, channel, "Use: /setscore [ID] [AMMOUNT]");
  636.  
  637.     SetPlayerScore(strval(tmp), strval(tmp2));
  638.  
  639.     new oname[MAX_PLAYER_NAME];
  640.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  641.  
  642.     new string[256];
  643.     format(string, sizeof(string), "\"%s\"'s score has been set to %d by IRC admin \"%s\"", oname, strval(tmp2), user);
  644.  
  645.     SendClientMessageToAll(yellow, string);
  646.     ircSay(conn, channel, string);
  647.     return 1;
  648. }
  649.  
  650. irccmd_setname(conn, channel[], user[], message[])
  651. {
  652.     new tmp[256], tmp2[256];
  653.     tmp = zcmd(1, message);
  654.     tmp2 = zcmd(2, message);
  655.  
  656.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  657.     if(strlen(tmp) == 0) return ircSay(conn, channel, "Use: /setname [ID] [NAME]");
  658.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  659.     if(strlen(tmp2) == 0) return ircSay(conn, channel, "Use: /setname [ID] [NAME]");
  660.  
  661.     new oname[MAX_PLAYER_NAME];
  662.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  663.  
  664.     new string[256];
  665.     format(string, sizeof(string), "\"%s\"'s score has had his name set to \"%s\" by IRC admin \"%s\"", oname, tmp2, user);
  666.    
  667.     SetPlayerName(strval(tmp), tmp2);
  668.  
  669.     SendClientMessageToAll(yellow, string);
  670.     ircSay(conn, channel, string);
  671.     return 1;
  672. }
  673.  
  674. irccmd_akill(conn, channel[], user[], message[])
  675. {
  676.     new tmp[256];
  677.     tmp = zcmd(1, message);
  678.  
  679.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  680.     if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  681.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  682.  
  683.     SetPlayerHealth(strval(tmp), 0);
  684.  
  685.     new oname[MAX_PLAYER_NAME];
  686.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  687.  
  688.     new string[256];
  689.     format(string, sizeof(string), "\"%s\" has been killed by IRC admin \"%s\"", oname, user);
  690.  
  691.     SendClientMessageToAll(yellow, string);
  692.     ircSay(conn, channel, string);
  693.     return 1;
  694. }
  695.  
  696. irccmd_giveweapon(conn, channel[], user[], message[])
  697. {
  698.     new tmp[256], tmp2[256], tmp3[256];
  699.     tmp = zcmd(1, message);
  700.     tmp2 = zcmd(2, message);
  701.     tmp3 = zcmd(3, message);
  702.  
  703.     if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  704.     if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  705.     if(strlen(tmp) == 0) return ircSay(conn, channel, "Use: /giveweapon [ID] [WEPID] [AMMO]");
  706.     if(strlen(tmp2) == 0) return ircSay(conn, channel, "Use: /giveweapon [ID] [WEPID] [AMMO]");
  707.     if(strlen(tmp3) == 0) return ircSay(conn, channel, "Use: /giveweapon [ID] [WEPID] [AMMO]");
  708.  
  709.     GivePlayerWeapon(strval(tmp), strval(tmp2), strval(tmp3));
  710.  
  711.     new oname[MAX_PLAYER_NAME];
  712.     GetPlayerName(strval(tmp), oname, sizeof(oname));
  713.  
  714.     new string[256];
  715.     format(string, sizeof(string), "\"%s\"'s has been given weapon ID %d with %d ammo by IRC admin \"%s\"", oname, strval(tmp2), strval(tmp3), user);
  716.  
  717.     SendClientMessageToAll(yellow, string);
  718.     ircSay(conn, channel, string);
  719.     return 1;
  720. }
  721.  
  722. irccmd_players(conn, channel[], user[], params[]) //made by Grove, taken from CYS Echo Bot 1.2
  723. {
  724.     new count, PlayerNames[512], string[256];
  725.     for(new i=0; i<=MAX_PLAYERS; i++)
  726.     {
  727.         if(IsPlayerConnected(i))
  728.         {
  729.             if(count == 0)
  730.             {
  731.                 new PlayerName1[MAX_PLAYER_NAME];
  732.                 GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
  733.                 format(PlayerNames, sizeof(PlayerNames),"2%s1", PlayerName1);
  734.                 count++;
  735.             }
  736.             else
  737.             {
  738.                 new PlayerName1[MAX_PLAYER_NAME];
  739.                 GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
  740.                 format(PlayerNames, sizeof(PlayerNames),"%s, 2%s1", PlayerNames, PlayerName1);
  741.                 count++;
  742.             }
  743.         }
  744.         else { if(count == 0) format(PlayerNames, sizeof(PlayerNames), "1No Players Online!"); }
  745.     }
  746.  
  747.     new counter = 0;
  748.     for(new i=0; i<=MAX_PLAYERS; i++)
  749.     {
  750.         if(IsPlayerConnected(i)) counter++;
  751.     }
  752.  
  753.     format(string, 256, "6Connected Players[%d]:1 %s", counter, PlayerNames);
  754.     ircSay(conn, channel, string);
  755.     #pragma unused params,user
  756.     return true;
  757. }
  758.  
  759. //end of commands
  760.  
  761. //SA-MP functions
  762.  
  763. public OnPlayerConnect(playerid)
  764. {
  765.     wire[playerid] = 0;
  766.     jail[playerid] = 0;
  767.    
  768.     new string[256], pname[MAX_PLAYER_NAME];
  769.     GetPlayerName(playerid, pname, sizeof(pname));
  770.     format(string, sizeof(string), "2%s has joined the server", pname);
  771.     ircSay(EchoConnection, EchoChan, string);
  772. }
  773.  
  774. public OnPlayerDisconnect(playerid)
  775. {
  776.     new string[256], pname[MAX_PLAYER_NAME];
  777.     GetPlayerName(playerid, pname, sizeof(pname));
  778.     format(string, sizeof(string), "2%s has left the server", pname);
  779.     ircSay(EchoConnection, EchoChan, string);
  780. }
  781.  
  782. public OnPlayerText(playerid, text[])
  783. {
  784.     if(wire[playerid] == 1)
  785.     {
  786.         SendClientMessage(playerid, red, ">> You can not talk when wired");
  787.         return 0;
  788.     }
  789.  
  790.     new string[256], pname[MAX_PLAYER_NAME];
  791.     GetPlayerName(playerid, pname, sizeof(pname));
  792.     format(string , sizeof(string),"4[%d]1 %s: %s", playerid, pname, text);
  793.     ircSay(EchoConnection, EchoChan, string);
  794.     return 1;
  795. }
  796.  
  797. public OnPlayerCommandText(playerid, cmdtext[])
  798. {
  799.     if(jail[playerid] == 1) return SendClientMessage(playerid, red, "You can not use commands when in jail");
  800.     return 0;
  801. }
  802.  
  803. //end of SA-MP functions
  804.  
  805. //other config [no need to modify]
  806.  
  807. RangeBan(playerid) //just so I don't have to add more credits, I'll use mine
  808. {
  809.     new pos, oldpos, ip[15], ip2[15], tmp[21];
  810.  
  811.     GetPlayerIp(playerid, ip, sizeof(ip));
  812.  
  813.     pos = strfind(ip, ".", true);
  814.     pos++;
  815.  
  816.     for(new i = 0; i < pos; i++)
  817.     {
  818.         ip2[i] = ip[pos-pos+i];
  819.     }
  820.  
  821.     pos--;
  822.  
  823.     ip[pos] = ' ';
  824.  
  825.     oldpos = pos;
  826.     oldpos++;
  827.  
  828.     pos = strfind(ip, ".", true);
  829.     pos++;
  830.  
  831.     for(new i = oldpos; i < pos; i++)
  832.     {
  833.         ip2[i] = ip[pos-pos+i];
  834.     }
  835.  
  836.     format(ip2, sizeof(ip2), "%s*.*", ip2);
  837.     format(tmp, sizeof(tmp), "banip %s", ip2);
  838.  
  839.     SendRconCommand(tmp);
  840.     return ip2;
  841. }
  842.  
  843. zcmd(param, cmdtext[])
  844. {
  845.     new pos, string[256], first = 1;
  846.     format(string, sizeof(string), "%s", cmdtext);
  847.  
  848.     for(new i = 0; i < param; i++)
  849.     {
  850.         if(first == 1)
  851.         {
  852.             first = 0;
  853.         }
  854.         else
  855.         {
  856.             pos = strfind(string, " ", true);
  857.             strdel(string, 0, pos + 1);
  858.         }
  859.     }
  860.  
  861.     if(strfind(string, " ", true))
  862.     {
  863.         pos = strfind(string, " ", true);
  864.         strdel(string, pos, 256);
  865.     }
  866.  
  867.     return string;
  868. }
  869.  
  870. Teleport(playerid, Float:x, Float:y, Float:z, Float:a, i)
  871. {
  872.     SetPlayerInterior(playerid, i);
  873.     SetCameraBehindPlayer(playerid);
  874.     ResetPlayerWeapons(playerid);
  875.  
  876.     if(IsPlayerInAnyVehicle(playerid) == 1)
  877.     {
  878.         SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);
  879.         SetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  880.         LinkVehicleToInterior(GetPlayerVehicleID(playerid), i);
  881.     }
  882.     else
  883.     {
  884.         SetPlayerPos(playerid, x, y, z);
  885.         SetPlayerFacingAngle(playerid, a);
  886.     }
  887. }
  888.  
  889. GetPlayerIDFromName(pname[])
  890. {
  891.     for(new i = 0; i < MAX_PLAYERS; i++)
  892.     {
  893.         new playername[MAX_PLAYER_NAME];
  894.         GetPlayerName(i, playername, sizeof(playername));
  895.         if(strfind(playername, pname, true) != -1)
  896.         return i + 0;
  897.     }
  898.     return -1;
  899. }
  900.  
  901. TeleportPlayer(playerid, Float:x, Float:y, Float:z, Float:a, i)
  902. {
  903.     SetPlayerPos(playerid, x, y, z);
  904.     SetPlayerFacingAngle(playerid, a);
  905.     SetPlayerInterior(playerid, i);
  906.     SetCameraBehindPlayer(playerid);
  907.     ResetPlayerWeapons(playerid);
  908. }
  909.  
  910. ircIsOp(conn, channel[], user[])
  911. {
  912.     new ircLevel[4];
  913.     ircGetUserLevel(conn, channel, user, ircLevel);
  914.     if(!strcmp(ircLevel, "~", true, 1) || !strcmp(ircLevel, "&", true, 1) || !strcmp(ircLevel, "@", true, 1)) return 1;
  915.     return 0;
  916. }
  917.  
  918. //end of other config
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement