Advertisement
Guest User

Untitled

a guest
May 16th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 8.16 KB | None | 0 0
  1. /*without this file it will crash
  2. filename: config.ini || location: scriptfiles
  3. contents bellow.
  4. Server=irc.ffsnetwork.com
  5. Port=6667
  6. NickName=Eddie
  7. RealName=IronMaiden Flight 666
  8. UserName=Flight666
  9. BotPass=changeme
  10. Channel=#F4U
  11. OwnerHost=haxx0r@TeH.Nubs.Side
  12.  
  13. */
  14. //the script
  15.  
  16. #include <a_samp>
  17. #include <irc>
  18. #include <dini>
  19.  
  20. #define CMD(%1) IRCCMD:%1(botid,channel[],user[],host[],params[])//these dont need "" marks
  21. #define AI(%1) if(!strcmp(message,%1,true))// these need to be in "" marks
  22. #define IsOwner !strcmp(host,dini_Get("config.ini","OwnerHost"))||!strcmp(host,"Brian@4B933423.8E309C18.D62824C9.IP")
  23.  
  24. #define MaxBots (2)//used for gBotID[]
  25. #define Config "config.ini"
  26.  
  27. forward IRC_ConnectDelay(tempid);
  28.  
  29. new gBotID[MaxBots];
  30. new loop;
  31.  
  32. main()//main() MUST BE IN HERE TO RUN AS A GAMEMODE!!1!
  33. {
  34.     print(">> MaXSpeeD IRC Command Bot Loaded!");
  35.     return 1;
  36. }
  37.  
  38. public OnGameModeInit()
  39. {
  40.     SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);//to stop from a network ban. also if you have more than one bot put the 2nd one at 10000
  41.     AddPlayerClass(0,0,0,0,0,0,0,0,0,0,0);
  42.     SetGameModeText("ZOHMEHGAWD!!1!");
  43.     return 1;
  44. }
  45.  
  46. public OnPlayerConnect(playerid) return Kick(playerid); //so it auto kicks
  47.  
  48. public OnGameModeExit()
  49. {
  50.     IRC_Quit(gBotID[0],"MaXSpeeD IRC Command Bot Unloaded");
  51.     return 0;
  52. }
  53.  
  54. public IRC_ConnectDelay(tempid)
  55. {
  56.     //connect to server
  57.     gBotID[0] = IRC_Connect(dini_Get(Config,"Server"),dini_Int(Config,"Port"),dini_Get(Config,"NickName"),dini_Get(Config,"RealName"),dini_Get(Config,"UserName"));
  58.     printf(">> Conected to Server: %s\n>> Port: %i\n>> NickName: %s\n>> RealName: %s\n>> UserName: %s",dini_Get(Config,"Server"),dini_Int(Config,"Port"),dini_Get(Config,"NickName"),dini_Get(Config,"RealName"),dini_Get(Config,"UserName"));
  59. }
  60.  
  61. public IRC_OnReceiveRaw(botid, message[])
  62. {
  63.     new File:file,output[1536];
  64.     strmid(output, message, 0, sizeof(output), sizeof(output));
  65.     if (!fexist("IrcRawLog.txt"))
  66.     {
  67.         file = fopen("IrcRawLog.txt", io_write);
  68.         fwrite(file, output);
  69.         fclose(file);
  70.     }
  71.     else
  72.     {
  73.         file = fopen("IrcRawLog.txt", io_append);
  74.         fwrite(file, output);
  75.         fclose(file);
  76.     }
  77.     return 1;
  78. }
  79.  
  80. public IRC_OnConnect(botid)
  81. {
  82.     new string[256];
  83.     format(string,sizeof(string),"ns identify %s",dini_Get(Config,"BotPass"));
  84.     printf(">> Identifing With Password: %s",dini_Get(Config,"BotPass"));
  85.     IRC_SendRaw(gBotID[0],string);
  86.     IRC_JoinChannel(gBotID[0],dini_Get(Config,"Channel"));//connect to cahnnel
  87.     printf(">> Joining Channel: %s",dini_Get(Config,"Channel"));
  88. }
  89.  
  90. public IRC_OnDisconnect(botid)
  91. {
  92.     loop=0;
  93.     SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);
  94.     return 1;
  95. }
  96.  
  97. public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
  98. {
  99.     AI("maxspeed") return IRC_Say(botid,recipient,"is fast");//example AIs from the #define at the top
  100.     AI("max") return IRC_Say(botid,recipient,"is fast");
  101.     AI("pawn") return IRC_Say(botid,recipient,"pwns n3rd");
  102.     AI("liquid") return IRC_Say(botid,recipient,"faps to pics of water");
  103.     AI("phletch") return IRC_Say(botid,recipient,"fucks cats");
  104.     AI("exotic") return IRC_Say(botid,recipient,"has a lot of cars");
  105.     AI("failure") return IRC_Say(botid,recipient,"fails");
  106.     AI("chon") return IRC_Say(botid,recipient,"can kiss my mummie ass");
  107.     AI("rey") return IRC_Say(botid,recipient,"is an idiot");
  108.     AI("assassin") return IRC_Say(botid,recipient,"sux at killing people");
  109.     return 1;
  110. }
  111. //some cmds
  112. CMD(topic)// uses !topic
  113. {
  114.     if(IsOwner)
  115.     {
  116.         if(!isnull(params))
  117.         {
  118.             new string[256];
  119.             new string2[256];
  120.             format(string,sizeof(string),"privmsg chanserv set %s topiclock off",dini_Get(Config,"Channel"));
  121.             format(string2,sizeof(string2),"privmsg chanserv set %s topiclock on",dini_Get(Config,"Channel"));
  122.             IRC_SendRaw(gBotID[0],string);
  123.             IRC_SetChannelTopic(gBotID[0],dini_Get(Config,"Channel"),params);
  124.             IRC_SendRaw(gBotID[0],string2);
  125.         }
  126.     }
  127.     return 1;
  128. }
  129.  
  130. CMD(nick)
  131. {
  132.     if(IsOwner)
  133.     {
  134.         if(!isnull(params))
  135.         {
  136.             IRC_ChangeNick(gBotID[0],params);
  137.             dini_Set(Config,"NickName",params);
  138.         }
  139.     }
  140.     return 1;
  141. }
  142.  
  143. CMD(mode)
  144. {
  145.     if(IRC_IsOwner(botid,channel,user)||IsOwner)//why isOwner? cus them god dem peops can use it to +q themselves
  146.     {
  147.         if(!isnull(params))
  148.         {
  149.             IRC_SetMode(gBotID[0],dini_Get(Config,"Channel"),params);
  150.         }
  151.         else return IRC_Say(gBotID[0],dini_Get(Config,"Channel"),"USAGE: !mode [mode]");
  152.     }
  153.     return 1;
  154. }
  155.  
  156. CMD(ban)
  157. {
  158.     if(IRC_IsOwner(botid,channel,user)||IsOwner)
  159.     {
  160.         if(!isnull(params))
  161.         {
  162.             if(IRC_IsOp(botid,channel,user)&&IRC_IsAdmin(botid,channel,params))
  163.             {
  164.                 IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
  165.             }
  166.             else
  167.             if(IRC_IsOp(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  168.             {
  169.                 IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
  170.             }
  171.             else
  172.             if(IRC_IsAdmin(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  173.             {
  174.                 IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
  175.             }
  176.             else
  177.             if(!strcmp(params[0],"MaXSpeeD",true)||!strcmp(params[0],"MaXSpeeD`",true))
  178.             {
  179.                 IRC_Notice(gBotID[0],user,"Rofl you cant ban him :p");
  180.             }
  181.             else
  182.             {
  183.                 new string[256];
  184.                 format(string,sizeof(string),"privmsg chanserv mode +b %s",params);
  185.                 IRC_SendRaw(gBotID[0],string);
  186.                 IRC_KickUser(gBotID[0],channel,params);
  187.             }
  188.         }
  189.     }
  190.     return 1;
  191. }
  192.  
  193. CMD(unban)
  194. {
  195.     if(IsOwner)
  196.     {
  197.         if(!isnull(params))
  198.         {
  199.                 new string[256];
  200.                 format(string,sizeof(string),"-b %s",params);
  201.                 IRC_Say(gBotID[0],channel,"Person Unbanned!");
  202.                 IRC_SetMode(gBotID[0],channel,string);
  203.         }
  204.     }
  205.    
  206.     return 1;
  207. }
  208.  
  209. CMD(akick)
  210. {
  211.     if(IRC_IsOp(botid,dini_Get(Config,"Channel"),user)||IsOwner)
  212.     {
  213.         if(!isnull(params))
  214.         {
  215.             if(IRC_IsOp(botid,channel,user)&&IRC_IsAdmin(botid,channel,params))
  216.             {
  217.                 IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
  218.             }
  219.             else
  220.             if(IRC_IsOp(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  221.             {
  222.                 IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
  223.             }
  224.             else
  225.             if(IRC_IsAdmin(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  226.             {
  227.                 IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
  228.             }
  229.             else
  230.             if(!strcmp(params,"MaXSpeeD",true)||!strcmp(params,"MaXSpeeD`",true))
  231.             {
  232.                 IRC_Notice(gBotID[0],user,"Rofl you cant kick him :p");
  233.             }
  234.             else return IRC_KickUser(gBotID[0],channel,params);
  235.         }
  236.     }
  237.     return 1;
  238. }
  239.  
  240. CMD(info)
  241. {
  242.     new string[256];
  243.     format(string,sizeof(string),"Host: %s Channel: %s there you go nub!",host,channel);
  244.     IRC_Say(gBotID[0],channel,string);
  245. }
  246.  
  247. CMD(restart)
  248. {
  249.     if(IsOwner)
  250.     {
  251.         SendRconCommand("gmx");
  252.         IRC_Say(gBotID[0],dini_Get(Config,"Channel"),"Restarting!");
  253.     }
  254.     return 1;
  255. }
  256.  
  257. CMD(exit)
  258. {
  259.     if(IsOwner)
  260.     {
  261.         SendRconCommand("exit");
  262.     }
  263.     return 0;
  264. }
  265.  
  266. CMD(register)
  267. {
  268.     if(IsOwner)
  269.     {
  270.         new string[256];
  271.         format(string,sizeof(string),"privmsg nickserv register %s DeadOnArrival@haxx.co.cc",dini_Get(Config,"BotPass"));
  272.         IRC_SendRaw(gBotID[0],string);
  273.     }
  274.     return 1;
  275. }
  276.  
  277. CMD(switch)
  278. {
  279.     if(IsOwner)
  280.     {
  281.         if(!isnull(params))
  282.         {
  283.             new string[256];
  284.             format(string,sizeof(string),"Joining: %s",params);
  285.             IRC_PartChannel(gBotID[0],channel,string);
  286.             IRC_JoinChannel(gBotID[0],params);
  287.             dini_Set(Config,"Channel",params);
  288.         }
  289.     }
  290.     return 1;
  291. }
  292.  
  293. CMD(vhost)
  294. {
  295.     if(IsOwner)
  296.     {
  297.         if(!isnull(params))
  298.         {
  299.             new string[256];
  300.             format(string,sizeof(string),"hs request %s",params);
  301.             IRC_SendRaw(gBotID[0],string);
  302.         }
  303.         else return IRC_Notice(gBotID[0],user,"USAGE: !vhost [params]");
  304.     }
  305.     else return IRC_Notice(gBotID[0],user,"I don't think so...");
  306.     return 1;
  307. }
  308.  
  309. CMD(spam)
  310. {
  311.     if(IsOwner)
  312.     {
  313.         if(!isnull(params))
  314.         {
  315.             loop = 1;
  316.             while(loop == 1)
  317.             {
  318.                 IRC_Say(gBotID[0],params,"SPAM!1!");
  319.             }
  320.         }
  321.         else return loop = 0;
  322.     }
  323.     else return IRC_Notice(gBotID[0],user,"Access Denied!");
  324.     return 1;
  325. }
  326.  
  327. CMD(join)
  328. {
  329.     if(IsOwner)
  330.     {
  331.         if(!isnull(params))
  332.         {
  333.             IRC_JoinChannel(gBotID[0],params);
  334.         }
  335.     }
  336.     return 1;
  337. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement