#include #include #include // IRC Example script // by Jacob forward main(); forward adminmsg(playerid, msg[]); forward vipmsg(playerid, msg[]); new AdminChan[256] = "%#grove"; new VIPChan[256] = "+#coldthugz.echo"; new channele[256] = "#coldthugz.echo"; new botname[256] = "Thug"; new botpass[256] = "sanandreas"; // IRC CODE /* 0 white 8 yellow 1 black 9 lightgreen 2 blue 10 cyan 3 green 11 lightcyan 4 lightred 12 lightblue 5 brown 13 pink 6 purple 14 grey 7 orange 15 lightgrey */ public main() { ircConnect("irc.gtanet.com", 6667, botname, botpass); print("---- thug connected to IRC ----"); } // This gets executed once you have connected to a channel public ircOnConnect() { ircJoinChan("#coldthugz 2522"); ircJoinChan("#grove"); ircJoinChan("#coldthugz.echo 2522"); ircSay("#coldthugz.echo", "4ColdThugZ Beta Pwnage 2Training Server 3.1 Loaded!"); ircSay("#coldthugz","2The ColdThugZ 4 Server is now 7Online!"); ircSay("#grove","2Sup Leaders! 4 Teh Server is now online! "); print("---- botozj connected to the channels ----"); } // This gets executed when someone says something in a channel you are in. public ircOnUserSay(channel[], user[], message[]) { // new msg[112]; new cmd[256]; new idx; // format(msg,sizeof(msg), "[IRC] %s: %s", channel, user, message); // SendClientMessageToAll(0xFFFFFFFF, msg); cmd = strtok(message, idx); if (message[0] != '!') return 1; if (strcmp("!msg", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 5, strlen(message)); new strmessage[64]; format(strmessage, sizeof(strmessage), "%s on IRC: %s", user, tmp); new ircmessage[64]; format(ircmessage, sizeof(ircmessage), "7[IRC]3 %s:1 %s", user, tmp); SendClientMessageToAll(0x00FFFFFF, strmessage); ircSay(channel, ircmessage); ircSay(#grove, ircmessage); } if (strcmp("!vip", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 5, strlen(message)); vipmsgirc(user, tmp); } if(!ircIsOp(channel,user)) return 1; if (strcmp("!kill", message, true, 10) == 0) // Allows players to kill you from IRC by typing ".kill"! { new tmp[256]; tmp = strtok(message, idx); if(!IsPlayerConnected(strval(tmp))){ ircSay(channel, "ERROR: Invalid playerid!"); return 1; } else { new strhealth[32]; SetPlayerHealth(strval(tmp), 0.0); new playername[256]; GetPlayerName(strval(tmp), playername, 256); format(strhealth, sizeof(strhealth), "%s (ID:%d) has been killed.", playername, strval(tmp)); ircSay(channel, strhealth); } } if (strcmp("!say", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 5, strlen(message)); new strmessage[64]; format(strmessage, sizeof(strmessage), "2* Administrator on IRC:1 %s", tmp); ircSay(channel, strmessage); ircSay(#grove, strmessage); new rconmsg[64]; format(rconmsg, sizeof(rconmsg), "say %s", tmp); SendRconCommand(rconmsg); } /* if (strcmp("!pm", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 4, strlen(message)); new message new strmessage[64]; format(strmessage, sizeof(strmessage), "2PM From %s (IRC) to %s (ID: %d)", user, GetPlayerName(tmptmp); ircSay(channel, strmessage); new rconmsg[64]; format(rconmsg, sizeof(rconmsg), "%s", tmp); SendRconCommand(rconmsg); }*/ if (strcmp("!admin", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 7, strlen(message)); adminmsgirc(user, tmp); } if (strcmp("!vip", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 5, strlen(message)); vipmsgirc(user, tmp); } if (strcmp("!raw", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 5, strlen(message)); new strmessage[64]; format(strmessage, sizeof(strmessage), "2Raw command sent.", tmp); ircSay(channel, strmessage); ircSay(#grove, strmessage); new rconmsg[64]; format(rconmsg, sizeof(rconmsg), "%s", tmp); SendRconCommand(rconmsg); } if (strcmp("!changemode", cmd, true, 10) == 0) { new tmp[256]; strmid(tmp, message, 12, strlen(message)); new strmessage[64]; format(strmessage, sizeof(strmessage), "2Gamemode changed to %s (if it exists)", tmp); ircSay(channel, strmessage); ircSay(#grove, strmessage); new rconmsg[64]; format(rconmsg, sizeof(rconmsg), "changemode %s", tmp); SendRconCommand(rconmsg); } if (strcmp("!restartirc", cmd, true, 11) == 0) { ircSay(channel, "2IRC Script Restarted."); SendRconCommand("unloadfs irc"); SendRconCommand("loadfs irc"); } return 1; } // This gets executed when someone parts a channel you are in. public ircOnUserPart(channel[], user[]) { // new msg[112]; // format(msg,sizeof(msg), "[%s] %s left the channel.", channel, user); // SendClientMessageToAll(0xFFFFFFFF, msg); return 1; } // This gets executed when someone joins a channel you are in. public ircOnUserJoin(channel[], user[]) { // new msg[112]; // format(msg,sizeof(msg), "[%s] %s joined the channel.", channel, user); // SendClientMessageToAll(0xFFFFFFFF, msg); // return 1; } public OnFilterScriptInit() { print("---- IRC Echo Initiated ----"); main(); return 1; } public OnPlayerConnect(playerid) { new connectname[256]; GetPlayerName(playerid, connectname, 256); new msg[256]; format(msg, sizeof(msg),"7%s (ID:%d) has joined the server!1",connectname,playerid); ircSay(channele,msg); ircSay(#grove,msg); return 1; } public OnPlayerDisconnect(playerid, reason) { new dconnectname[256]; GetPlayerName(playerid, dconnectname, 256); new msg[256]; format(msg, sizeof(msg),"7%s has left the server!1",dconnectname); ircSay(channele,msg); return 1; } public OnPlayerSpawn(playerid) { return 1; } public OnPlayerDeath(playerid, killerid, reason) { new msg[256]; format(msg, sizeof(msg),"4%s has died.1",name(playerid)); ircSay(channele,msg); ircSay(#grove,msg); return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { if(text[0] == '@') { new tmp[256]; strmid(tmp, text, 1, strlen(text)); adminmsg(playerid, tmp); return 0; } if(text[0] == '!') { new tmp[256]; strmid(tmp, text, 1, strlen(text)); vipmsg(playerid, tmp); return 0; } new textx[256]; format(textx, sizeof(textx),"[%d]3 %s:1 %s",playerid,name(playerid),text); ircSay(#coldthugz.echo, textx); ircSay(#grove, textx); return 1; } public OnPlayerPrivmsg(playerid, recieverid, text[]) { new textx[256]; format(textx, sizeof(textx),"7PM:3 %s[%d] to %s[%d]:1 %s",name(playerid),playerid,name(recieverid),recieverid,text); ircSay("%#grove", textx); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { new idx; new command[256]; command = strtok(cmdtext, idx); if(!IsPlayerAdmin(playerid)) return 0; // admin point from here on if (strcmp("/closeirc", command, true, 10) == 0) { ircDisconnect(); return 1; } if (strcmp("/openirc", command, true, 10) == 0) { SendRconCommand("unloadfs irc"); SendRconCommand("loadfs irc"); return 1; } /* if(strcmp("/help", command, true, 1) == 0) { SendClientMessage(playerid,0xDC143CFF,"@ to talk to admins. % to talk to VIPs."); return 1; }*/ return 0; } public OnRconCommand(cmd[]) { return 1; } public adminmsg(playerid,msg[]) { new gmsg[256]; format(gmsg,sizeof(gmsg),"Admin Message from %s (ID:%d): %s", name(playerid), playerid, msg); new fmsg[256]; format(fmsg,sizeof(fmsg),"7Admin Message from %s (ID:%d):1 %s", name(playerid), playerid, msg); for(new i=0; i < 32; i++) { if(IsPlayerAdmin(i)) { SendClientMessage(i, 0xFFFF00FF, gmsg); } } if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid, 0xFFFF00FF, "Your message has been sent to online admins!"); ircSay(AdminChan, fmsg); } public vipmsg(playerid,msg[]) { new vgmsg[256]; format(vgmsg,sizeof(vgmsg),"VIP Message from %s (ID:%d): %s", name(playerid), playerid, msg); new vfmsg[256]; format(vfmsg,sizeof(vfmsg),"10VIP Message from %s (ID:%d):1 %s", name(playerid), playerid, msg); for(new i=0; i < 32; i++) { if(IsPlayerAdmin(i)) { SendClientMessage(i, 0xFF8C13FF, vgmsg); } } if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid, 0xFF8C13FF, "Your message has been sent to online VIPs!"); ircSay(VIPChan, vfmsg); } adminmsgirc(name[], msg[]) { new gmsg[256]; format(gmsg,sizeof(gmsg),"Admin Message from %s (IRC): %s", name, msg); new fmsg[256]; format(fmsg,sizeof(fmsg),"7Admin Message from %s (IRC):1 %s", name, msg); for(new i=0; i < 32; i++) { if(IsPlayerAdmin(i)) { SendClientMessage(i, 0xFFFF00FF, gmsg); } } ircSay(AdminChan, fmsg); } vipmsgirc(name[], msg[]) { new vgmsg[256]; format(vgmsg,sizeof(vgmsg),"VIP Message from %s (IRC): %s", name, msg); new vfmsg[256]; format(vfmsg,sizeof(vfmsg),"10VIP Message from %s (IRC):1 %s", name, msg); for(new i=0; i < 32; i++) { if(IsPlayerAdmin(i)) { SendClientMessage(i, 0xFF8C13FF, vgmsg); } } ircSay(VIPChan, vfmsg); } stock name(playerid) { new namer[256]; GetPlayerName(playerid, namer, sizeof(namer)); return namer; } #pragma unused ret_memcpy