Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*without this file it will crash
- filename: config.ini || location: scriptfiles
- contents bellow.
- Server=irc.ffsnetwork.com
- Port=6667
- NickName=Eddie
- RealName=IronMaiden Flight 666
- UserName=Flight666
- BotPass=changeme
- Channel=#F4U
- OwnerHost=haxx0r@TeH.Nubs.Side
- */
- //the script
- #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];
- new loop;
- main()//main() MUST BE IN HERE TO RUN AS A GAMEMODE!!1!
- {
- print(">> MaXSpeeD 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],"MaXSpeeD IRC Command Bot Unloaded");
- 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)
- {
- loop=0;
- SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);
- return 1;
- }
- public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
- {
- AI("maxspeed") return IRC_Say(botid,recipient,"is fast");//example AIs from the #define at the top
- AI("max") return IRC_Say(botid,recipient,"is fast");
- AI("pawn") return IRC_Say(botid,recipient,"pwns n3rd");
- AI("liquid") return IRC_Say(botid,recipient,"faps to pics of water");
- AI("phletch") return IRC_Say(botid,recipient,"fucks cats");
- AI("exotic") return IRC_Say(botid,recipient,"has a lot of cars");
- AI("failure") return IRC_Say(botid,recipient,"fails");
- AI("chon") return IRC_Say(botid,recipient,"can kiss my mummie ass");
- AI("rey") return IRC_Say(botid,recipient,"is an idiot");
- AI("assassin") return IRC_Say(botid,recipient,"sux at killing people");
- 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],"MaXSpeeD",true)||!strcmp(params[0],"MaXSpeeD`",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,"MaXSpeeD",true)||!strcmp(params,"MaXSpeeD`",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),"Host: %s Channel: %s there you go nub!",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(switch)
- {
- 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(vhost)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- new string[256];
- format(string,sizeof(string),"hs request %s",params);
- IRC_SendRaw(gBotID[0],string);
- }
- else return IRC_Notice(gBotID[0],user,"USAGE: !vhost [params]");
- }
- else return IRC_Notice(gBotID[0],user,"I don't think so...");
- return 1;
- }
- CMD(spam)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- loop = 1;
- while(loop == 1)
- {
- IRC_Say(gBotID[0],params,"SPAM!1!");
- }
- }
- else return loop = 0;
- }
- else return IRC_Notice(gBotID[0],user,"Access Denied!");
- return 1;
- }
- CMD(join)
- {
- if(IsOwner)
- {
- if(!isnull(params))
- {
- IRC_JoinChannel(gBotID[0],params);
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement