Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <irc>
- #include <dini>
- #define CMD(%1) IRCCMD:%1(botid,channel[],user[],host[],params[])//these dont need "" marks
- #define AI(%1) if(!strcmp(message,%1,true))// these need to be in "" marks
- #define IsOwner !strcmp(host,dini_Get("config.ini","OwnerHost"))||!strcmp(host,"Brian@4B933423.8E309C18.D62824C9.IP")
- #define MaxBots (2)//used for gBotID[]
- #define Config "config.ini"
- forward IRC_ConnectDelay(tempid);
- new gBotID[MaxBots];
- main()//main() MUST BE IN HERE TO RUN AS A GAMEMODE!!1!
- {
- print(">> Assassin IRC Command Bot Loaded!");
- return 1;
- }
- public OnGameModeInit()
- {
- 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
- AddPlayerClass(0,0,0,0,0,0,0,0,0,0,0);
- SetGameModeText("ZOHMEHGAWD!!1!");
- return 1;
- }
- public OnPlayerConnect(playerid) return Kick(playerid); //so it auto kicks
- public OnGameModeExit()
- {
- IRC_Quit(gBotID[0],"Bye");
- return 0;
- }
- public IRC_ConnectDelay(tempid)
- {
- //connect to server
- gBotID[0] = IRC_Connect(dini_Get(Config,"Server"),dini_Int(Config,"Port"),dini_Get(Config,"NickName"),dini_Get(Config,"RealName"),dini_Get(Config,"UserName"));
- 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"));
- }
- public IRC_OnReceiveRaw(botid, message[])
- {
- new File:file,output[1536];
- strmid(output, message, 0, sizeof(output), sizeof(output));
- if (!fexist("IrcRawLog.txt"))
- {
- file = fopen("IrcRawLog.txt", io_write);
- fwrite(file, output);
- fclose(file);
- }
- else
- {
- file = fopen("IrcRawLog.txt", io_append);
- fwrite(file, output);
- fclose(file);
- }
- return 1;
- }
- public IRC_OnConnect(botid)
- {
- new string[256];
- format(string,sizeof(string),"ns identify %s",dini_Get(Config,"BotPass"));
- printf(">> Identifing With Password: %s",dini_Get(Config,"BotPass"));
- IRC_SendRaw(gBotID[0],string);
- IRC_JoinChannel(gBotID[0],dini_Get(Config,"Channel"));//connect to cahnnel
- printf(">> Joining Channel: %s",dini_Get(Config,"Channel"));
- }
- public IRC_OnDisconnect(botid)
- {
- SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);
- return 1;
- }
- public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
- {
- AI("maxspeed") return IRC_Say(botid,recipient,"smells :3");//example AIs from the #define at the top
- AI("max") return IRC_Say(botid,recipient,"smells :3");
- AI("pawn") return IRC_Say(botid,recipient,"pwns n3rd");
- AI("liquid") return IRC_Say(botid,recipient,"is a CoD fag");
- AI("phletch") return IRC_Say(botid,recipient,"no comment, just <3");
- AI("exotic") return IRC_Say(botid,recipient,"is GOOD AT ALL THING...");
- AI("fail") return IRC_Say(botid,recipient,"is a n00b :3");
- AI("chonlel") return IRC_Say(botid,recipient,"has an asian fetish");
- AI("rey") return IRC_Say(botid,recipient,"rey? he pwns(blah!)");
- AI("assassin") return IRC_Say(botid,recipient,"haz a crazy ping <.>");
- AI("cj101") return IRC_Say(botid,recipient,"Pwns all!");
- AI("u.u") return IRC_Say(botid,recipient,"n.n");
- AI("n.n") return IRC_Say(botid,recipient,"u.u");
- AI("hello xr-z") return IRC_Say(botid,recipient,"Hello :o");
- AI("hi xr-z") return IRC_Say(botid,recipient,"Hello :o");
- AI("u sux") return IRC_Say(botid,recipient,"no u sux");
- AI("xr-z sux") return IRC_Say(botid,recipient,"no u sux");
- AI("xrz sux") return IRC_Say(botid,recipient,"no u sux");
- AI("orly?") return IRC_Say(botid,recipient,"yarly");
- AI("orly") return IRC_Say(botid,recipient,"yarly");
- return 1;
- }
- //some cmds
- CMD(topic)// uses !topic
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- new string[256];
- new string2[256];
- format(string,sizeof(string),"privmsg chanserv set %s topiclock off",dini_Get(Config,"Channel"));
- format(string2,sizeof(string2),"privmsg chanserv set %s topiclock on",dini_Get(Config,"Channel"));
- IRC_SendRaw(gBotID[0],string);
- IRC_SetChannelTopic(gBotID[0],dini_Get(Config,"Channel"),params);
- IRC_SendRaw(gBotID[0],string2);
- }
- }
- return 1;
- }
- CMD(nick)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- IRC_ChangeNick(gBotID[0],params);
- dini_Set(Config,"NickName",params);
- }
- }
- return 1;
- }
- CMD(mode)
- {
- if(IRC_IsOwner(botid,channel,user)||IsOwner)//why isOwner? cus them god dem peops can use it to +q themselves
- {
- if(!isnull(params))
- {
- IRC_SetMode(gBotID[0],dini_Get(Config,"Channel"),params);
- }
- else return IRC_Say(gBotID[0],dini_Get(Config,"Channel"),"USAGE: !mode [mode]");
- }
- return 1;
- }
- CMD(ban)
- {
- if(IRC_IsOwner(botid,channel,user)||IsOwner)
- {
- if(!isnull(params))
- {
- if(IRC_IsOp(botid,channel,user)&&IRC_IsAdmin(botid,channel,params))
- {
- IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
- }
- else
- if(IRC_IsOp(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
- {
- IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
- }
- else
- if(IRC_IsAdmin(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
- {
- IRC_Notice(gBotID[0],user,"ERROR: You can't ban that person!");
- }
- else
- if(!strcmp(params[0],"Assassin",true)||!strcmp(params[0],"Assassin`",true))
- {
- IRC_Notice(gBotID[0],user,"Rofl you cant ban him :p");
- }
- else
- {
- new string[256];
- format(string,sizeof(string),"privmsg chanserv mode +b %s",params);
- IRC_SendRaw(gBotID[0],string);
- IRC_KickUser(gBotID[0],channel,params);
- }
- }
- }
- return 1;
- }
- CMD(unban)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- new string[256];
- format(string,sizeof(string),"-b %s",params);
- IRC_Say(gBotID[0],channel,"Person Unbanned!");
- IRC_SetMode(gBotID[0],channel,string);
- }
- }
- return 1;
- }
- CMD(akick)
- {
- if(IRC_IsOp(botid,dini_Get(Config,"Channel"),user)||IsOwner)
- {
- if(!isnull(params))
- {
- if(IRC_IsOp(botid,channel,user)&&IRC_IsAdmin(botid,channel,params))
- {
- IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
- }
- else
- if(IRC_IsOp(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
- {
- IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
- }
- else
- if(IRC_IsAdmin(botid,channel,user)&&IRC_IsOwner(botid,channel,params))
- {
- IRC_Notice(gBotID[0],user,"ERROR: You can't kick that person!");
- }
- else
- if(!strcmp(params,"Assassin",true)||!strcmp(params,"Assassin`",true))
- {
- IRC_Notice(gBotID[0],user,"Rofl you cant kick him :p");
- }
- else return IRC_KickUser(gBotID[0],channel,params);
- }
- }
- return 1;
- }
- CMD(info)
- {
- new string[256];
- format(string,sizeof(string),"- XR-Z Proto-Bot - made by Assassin",host,channel);
- IRC_Say(gBotID[0],channel,string);
- }
- CMD(restart)
- {
- if(IsOwner)
- {
- SendRconCommand("gmx");
- IRC_Say(gBotID[0],dini_Get(Config,"Channel"),"Restarting...");
- }
- return 1;
- }
- CMD(exit)
- {
- if(IsOwner)
- {
- SendRconCommand("exit");
- }
- return 0;
- }
- CMD(register)
- {
- if(IsOwner)
- {
- new string[256];
- format(string,sizeof(string),"privmsg nickserv register %s DeadOnArrival@haxx.co.cc",dini_Get(Config,"BotPass"));
- IRC_SendRaw(gBotID[0],string);
- }
- return 1;
- }
- CMD(change)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- new string[256];
- format(string,sizeof(string),"Joining: %s",params);
- IRC_PartChannel(gBotID[0],channel,string);
- IRC_JoinChannel(gBotID[0],params);
- dini_Set(Config,"Channel",params);
- }
- }
- return 1;
- }
- CMD(join)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- IRC_JoinChannel(gBotID[0],params);
- new string[256]; //not done yet
- format(string,256,"Channel joined.");
- IRC_Say(gBotID[0],channel,string);
- }
- }
- return 1;
- }
- CMD(credits)//:p
- {
- IRC_Notice(gBotID[0],user,"Credits to Assassin and Maxspeed ofc");//can compile now
- return 1;
- }
- CMD(invite)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- IRC_Say(gBotID[0],params,"You have been invited to join #assassin92 (and don't forget to do /ns ajoin add #assassin92 :D)");
- new string[256]; //not done yet
- format(string,256,"An invitation has been sent to %s",params);
- IRC_Say(gBotID[0],channel,string);
- }
- }
- return 1;
- }
- CMD(say)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- IRC_Say(gBotID[0],channel,params);
- }
- else return IRC_Notice(gBotID[0],user,"USAGE: !say [params]");
- }
- return 1;
- }
- CMD(part)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- new string[256]; //not done yet
- format(string,256,"Leaving channel...");
- IRC_Say(gBotID[0],channel,string);
- IRC_PartChannel(gBotID[0],params);
- }
- }
- return 1;
- }
- CMD(ajoin)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- new string[256],str2[256];
- format(str2,256,"Added %s to the ajoin list",params);
- format(string,256,"ns ajoin add %s",params);
- IRC_SendRaw(gBotID[0],string);
- IRC_Say(gBotID[0],channel,str2);
- }
- }
- return 1;
- }
- CMD(ragepart)
- {
- if(IsOwner)
- {
- {
- new string[256]; //not finished...
- format(string,256,"FFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU");
- IRC_Say(gBotID[0],channel,string);
- IRC_PartChannel(gBotID[0],channel);
- }
- }
- return 1;
- }
- CMD(me)
- {
- if(IsOwner&&!isnull(params))
- {
- new string[256];
- format(string,256,"\001ACTION %s\001",params);
- IRC_Say(gBotID[0],channel,string);
- }
- return 1;
- }
- CMD(rejoin)
- {
- if(IsOwner)
- {
- {
- IRC_PartChannel(gBotID[0],channel);
- IRC_JoinChannel(gBotID[0],channel);
- }
- }
- return 1;
- }
- CMD(remajoin)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- new string[256],str2[256];
- format(str2,256,"Removed %s from the ajoin list",params);
- format(string,256,"ns ajoin del %s",params);
- IRC_SendRaw(gBotID[0],string);
- IRC_Say(gBotID[0],channel,str2);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement