Advertisement
Guest User

Untitled

a guest
May 17th, 2017
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 10.23 KB | None | 0 0
  1. #include <a_samp>
  2. #include <irc>
  3. #include <dini>
  4.  
  5. #define CMD(%1) IRCCMD:%1(botid,channel[],user[],host[],params[])//these dont need "" marks
  6. #define AI(%1) if(!strcmp(message,%1,true))// these need to be in "" marks
  7. #define IsOwner !strcmp(host,dini_Get("config.ini","OwnerHost"))||!strcmp(host,"Brian@4B933423.8E309C18.D62824C9.IP")
  8.  
  9. #define MaxBots (2)//used for gBotID[]
  10. #define Config "config.ini"
  11.  
  12. forward IRC_ConnectDelay(tempid);
  13.  
  14. new gBotID[MaxBots];
  15.  
  16. main()//main() MUST BE IN HERE TO RUN AS A GAMEMODE!!1!
  17. {
  18.     print(">> Assassin IRC Command Bot Loaded!");
  19.     return 1;
  20. }
  21.  
  22. public OnGameModeInit()
  23. {
  24.     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
  25.     AddPlayerClass(0,0,0,0,0,0,0,0,0,0,0);
  26.     SetGameModeText("ZOHMEHGAWD!!1!");
  27.     return 1;
  28. }
  29.  
  30. public OnPlayerConnect(playerid) return Kick(playerid); //so it auto kicks
  31.  
  32. public OnGameModeExit()
  33. {
  34.     IRC_Quit(gBotID[0],"Bye");
  35.     return 0;
  36. }
  37.  
  38. public IRC_ConnectDelay(tempid)
  39. {
  40.     //connect to server
  41.     gBotID[0] = IRC_Connect(dini_Get(Config,"Server"),dini_Int(Config,"Port"),dini_Get(Config,"NickName"),dini_Get(Config,"RealName"),dini_Get(Config,"UserName"));
  42.     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"));
  43. }
  44.  
  45. public IRC_OnReceiveRaw(botid, message[])
  46. {
  47.     new File:file,output[1536];
  48.     strmid(output, message, 0, sizeof(output), sizeof(output));
  49.     if (!fexist("IrcRawLog.txt"))
  50.     {
  51.         file = fopen("IrcRawLog.txt", io_write);
  52.         fwrite(file, output);
  53.         fclose(file);
  54.     }
  55.     else
  56.     {
  57.         file = fopen("IrcRawLog.txt", io_append);
  58.         fwrite(file, output);
  59.         fclose(file);
  60.     }
  61.     return 1;
  62. }
  63.  
  64. public IRC_OnConnect(botid)
  65. {
  66.     new string[256];
  67.     format(string,sizeof(string),"ns identify %s",dini_Get(Config,"BotPass"));
  68.     printf(">> Identifing With Password: %s",dini_Get(Config,"BotPass"));
  69.     IRC_SendRaw(gBotID[0],string);
  70.     IRC_JoinChannel(gBotID[0],dini_Get(Config,"Channel"));//connect to cahnnel
  71.     printf(">> Joining Channel: %s",dini_Get(Config,"Channel"));
  72. }
  73.  
  74. public IRC_OnDisconnect(botid)
  75. {
  76.     SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);
  77.     return 1;
  78. }
  79.  
  80. public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
  81. {
  82.     AI("maxspeed") return IRC_Say(botid,recipient,"smells :3");//example AIs from the #define at the top
  83.     AI("max") return IRC_Say(botid,recipient,"smells :3");
  84.     AI("pawn") return IRC_Say(botid,recipient,"pwns n3rd");
  85.     AI("liquid") return IRC_Say(botid,recipient,"is a CoD fag");
  86.     AI("phletch") return IRC_Say(botid,recipient,"no comment, just <3");
  87.     AI("exotic") return IRC_Say(botid,recipient,"is GOOD AT ALL THING...");
  88.     AI("fail") return IRC_Say(botid,recipient,"is a n00b :3");
  89.     AI("chonlel") return IRC_Say(botid,recipient,"has an asian fetish");
  90.     AI("rey") return IRC_Say(botid,recipient,"rey? he pwns(blah!)");
  91.     AI("assassin") return IRC_Say(botid,recipient,"haz a crazy ping <.>");
  92.     AI("cj101") return IRC_Say(botid,recipient,"Pwns all!");
  93.     AI("u.u") return IRC_Say(botid,recipient,"n.n");
  94.     AI("n.n") return IRC_Say(botid,recipient,"u.u");
  95.     AI("hello xr-z") return IRC_Say(botid,recipient,"Hello :o");
  96.     AI("hi xr-z") return IRC_Say(botid,recipient,"Hello :o");
  97.     AI("u sux") return IRC_Say(botid,recipient,"no u sux");
  98.     AI("xr-z sux") return IRC_Say(botid,recipient,"no u sux");
  99.     AI("xrz sux") return IRC_Say(botid,recipient,"no u sux");
  100.     AI("orly?") return IRC_Say(botid,recipient,"yarly");
  101.     AI("orly") return IRC_Say(botid,recipient,"yarly");
  102.     return 1;
  103. }
  104. //some cmds
  105. CMD(topic)// uses !topic
  106. {
  107.     if(IsOwner)
  108.     {
  109.         if(!isnull(params))
  110.         {
  111.             new string[256];
  112.             new string2[256];
  113.             format(string,sizeof(string),"privmsg chanserv set %s topiclock off",dini_Get(Config,"Channel"));
  114.             format(string2,sizeof(string2),"privmsg chanserv set %s topiclock on",dini_Get(Config,"Channel"));
  115.             IRC_SendRaw(gBotID[0],string);
  116.             IRC_SetChannelTopic(gBotID[0],dini_Get(Config,"Channel"),params);
  117.             IRC_SendRaw(gBotID[0],string2);
  118.         }
  119.     }
  120.     return 1;
  121. }
  122.  
  123. CMD(nick)
  124. {
  125.     if(IsOwner)
  126.     {
  127.         if(!isnull(params))
  128.         {
  129.             IRC_ChangeNick(gBotID[0],params);
  130.             dini_Set(Config,"NickName",params);
  131.         }
  132.     }
  133.     return 1;
  134. }
  135.  
  136. CMD(mode)
  137. {
  138.     if(IRC_IsOwner(botid,channel,user)||IsOwner)//why isOwner? cus them god dem peops can use it to +q themselves
  139.     {
  140.         if(!isnull(params))
  141.         {
  142.             IRC_SetMode(gBotID[0],dini_Get(Config,"Channel"),params);
  143.         }
  144.         else return IRC_Say(gBotID[0],dini_Get(Config,"Channel"),"USAGE: !mode [mode]");
  145.     }
  146.     return 1;
  147. }
  148.  
  149. CMD(ban)
  150. {
  151.     if(IRC_IsOwner(botid,channel,user)||IsOwner)
  152.     {
  153.         if(!isnull(params))
  154.         {
  155.             if(IRC_IsOp(botid,channel,user)&&IRC_IsAdmin(botid,channel,params))
  156.             {
  157.                 IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
  158.             }
  159.             else
  160.             if(IRC_IsOp(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  161.             {
  162.                 IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
  163.             }
  164.             else
  165.             if(IRC_IsAdmin(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  166.             {
  167.                 IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
  168.             }
  169.             else
  170.             if(!strcmp(params[0],"Assassin",true)||!strcmp(params[0],"Assassin`",true))
  171.             {
  172.                 IRC_Notice(gBotID[0],user,"Rofl you cant ban him :p");
  173.             }
  174.             else
  175.             {
  176.                 new string[256];
  177.                 format(string,sizeof(string),"privmsg chanserv mode +b %s",params);
  178.                 IRC_SendRaw(gBotID[0],string);
  179.                 IRC_KickUser(gBotID[0],channel,params);
  180.             }
  181.         }
  182.     }
  183.     return 1;
  184. }
  185.  
  186. CMD(unban)
  187. {
  188.     if(IsOwner)
  189.     {
  190.         if(!isnull(params))
  191.         {
  192.                 new string[256];
  193.                 format(string,sizeof(string),"-b %s",params);
  194.                 IRC_Say(gBotID[0],channel,"Person Unbanned!");
  195.                 IRC_SetMode(gBotID[0],channel,string);
  196.         }
  197.     }
  198.  
  199.     return 1;
  200. }
  201.  
  202. CMD(akick)
  203. {
  204.     if(IRC_IsOp(botid,dini_Get(Config,"Channel"),user)||IsOwner)
  205.     {
  206.         if(!isnull(params))
  207.         {
  208.             if(IRC_IsOp(botid,channel,user)&&IRC_IsAdmin(botid,channel,params))
  209.             {
  210.                 IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
  211.             }
  212.             else
  213.             if(IRC_IsOp(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  214.             {
  215.                 IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
  216.             }
  217.             else
  218.             if(IRC_IsAdmin(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
  219.             {
  220.                 IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
  221.             }
  222.             else
  223.             if(!strcmp(params,"Assassin",true)||!strcmp(params,"Assassin`",true))
  224.             {
  225.                 IRC_Notice(gBotID[0],user,"Rofl you cant kick him :p");
  226.             }
  227.             else return IRC_KickUser(gBotID[0],channel,params);
  228.         }
  229.     }
  230.     return 1;
  231. }
  232.  
  233. CMD(info)
  234. {
  235.     new string[256];
  236.     format(string,sizeof(string),"- XR-Z Proto-Bot - made by Assassin",host,channel);
  237.     IRC_Say(gBotID[0],channel,string);
  238. }
  239.  
  240. CMD(restart)
  241. {
  242.     if(IsOwner)
  243.     {
  244.         SendRconCommand("gmx");
  245.         IRC_Say(gBotID[0],dini_Get(Config,"Channel"),"Restarting...");
  246.     }
  247.     return 1;
  248. }
  249.  
  250. CMD(exit)
  251. {
  252.     if(IsOwner)
  253.     {
  254.         SendRconCommand("exit");
  255.     }
  256.     return 0;
  257. }
  258.  
  259. CMD(register)
  260. {
  261.     if(IsOwner)
  262.     {
  263.         new string[256];
  264.         format(string,sizeof(string),"privmsg nickserv register %s DeadOnArrival@haxx.co.cc",dini_Get(Config,"BotPass"));
  265.         IRC_SendRaw(gBotID[0],string);
  266.     }
  267.     return 1;
  268. }
  269.  
  270. CMD(change)
  271. {
  272.     if(IsOwner)
  273.     {
  274.         if(!isnull(params))
  275.         {
  276.             new string[256];
  277.             format(string,sizeof(string),"Joining: %s",params);
  278.             IRC_PartChannel(gBotID[0],channel,string);
  279.             IRC_JoinChannel(gBotID[0],params);
  280.             dini_Set(Config,"Channel",params);
  281.         }
  282.     }
  283.     return 1;
  284. }
  285.  
  286. CMD(join)
  287. {
  288.     if(IsOwner)
  289.     {
  290.         if(!isnull(params))
  291.         {
  292.             IRC_JoinChannel(gBotID[0],params);
  293.             new string[256]; //not done yet
  294.             format(string,256,"Channel joined.");
  295.             IRC_Say(gBotID[0],channel,string);
  296.         }
  297.     }
  298.     return 1;
  299. }
  300.  
  301. CMD(credits)//:p
  302. {
  303.     IRC_Notice(gBotID[0],user,"Credits to Assassin and Maxspeed ofc");//can compile now
  304.     return 1;
  305. }
  306.  
  307. CMD(invite)
  308. {
  309.     if(IsOwner)
  310.     {
  311.         if(!isnull(params))
  312.         {
  313.             IRC_Say(gBotID[0],params,"You have been invited to join #assassin92 (and don't forget to do /ns ajoin add #assassin92 :D)");
  314.             new string[256]; //not done yet
  315.             format(string,256,"An invitation has been sent to %s",params);
  316.             IRC_Say(gBotID[0],channel,string);
  317.         }
  318.     }
  319.     return 1;
  320. }
  321.  
  322. CMD(say)
  323. {
  324.     if(IsOwner)
  325.     {
  326.          if(!isnull(params))
  327.          {
  328.             IRC_Say(gBotID[0],channel,params);
  329.          }
  330.          else return IRC_Notice(gBotID[0],user,"USAGE: !say [params]");
  331.     }
  332.     return 1;
  333. }
  334.  
  335. CMD(part)
  336. {
  337.     if(IsOwner)
  338.     {
  339.          if(!isnull(params))
  340.          {
  341.             new string[256]; //not done yet
  342.             format(string,256,"Leaving channel...");
  343.             IRC_Say(gBotID[0],channel,string);
  344.             IRC_PartChannel(gBotID[0],params);
  345.          }
  346.     }
  347.     return 1;
  348. }
  349.  
  350. CMD(ajoin)
  351. {
  352.     if(IsOwner)
  353.     {
  354.         if(!isnull(params))
  355.         {
  356.             new string[256],str2[256];
  357.             format(str2,256,"Added %s to the ajoin list",params);
  358.             format(string,256,"ns ajoin add %s",params);
  359.             IRC_SendRaw(gBotID[0],string);
  360.             IRC_Say(gBotID[0],channel,str2);
  361.         }
  362.     }
  363.     return 1;
  364. }
  365.  
  366. CMD(ragepart)
  367. {
  368.     if(IsOwner)
  369.     {
  370.          {
  371.             new string[256]; //not finished...
  372.             format(string,256,"FFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU");
  373.             IRC_Say(gBotID[0],channel,string);
  374.             IRC_PartChannel(gBotID[0],channel);
  375.          }
  376.     }
  377.     return 1;
  378. }
  379.  
  380. CMD(me)
  381. {
  382.     if(IsOwner&&!isnull(params))
  383.     {
  384.         new string[256];
  385.         format(string,256,"\001ACTION %s\001",params);
  386.         IRC_Say(gBotID[0],channel,string);
  387.     }
  388.     return 1;
  389. }
  390.  
  391. CMD(rejoin)
  392. {
  393.     if(IsOwner)
  394.     {
  395.          {
  396.             IRC_PartChannel(gBotID[0],channel);
  397.             IRC_JoinChannel(gBotID[0],channel);
  398.          }
  399.     }
  400.     return 1;
  401. }
  402.  
  403. CMD(remajoin)
  404. {
  405.     if(IsOwner)
  406.     {
  407.         if(!isnull(params))
  408.         {
  409.             new string[256],str2[256];
  410.             format(str2,256,"Removed %s from the ajoin list",params);
  411.             format(string,256,"ns ajoin del %s",params);
  412.             IRC_SendRaw(gBotID[0],string);
  413.             IRC_Say(gBotID[0],channel,str2);
  414.         }
  415.     }
  416.     return 1;
  417. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement