#include <a_samp> /* Simple irc echo filterscript Brought to you by [NB]Sneaky www.99BlaZed.com www.sneakyhost.net Player Commands: !imsg <send message to server> !igetid <get a players id based on nickname> Admin Commands: !iban <ban a player with optional reason> !ikick <kick a player with optional reason> !islap <slap a player with optional reason> !ikill <kill a player with optional reason> !isay <send message to the server as admin> !ipause <pause the echo, !pause again to unpause> DO NOT REMOVE CREDITS! That's all I ask. */ #define irccmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (irccmd_%1(conn,channel,user,"")))||(((%3)[(%2) + 1] == 32) && (irccmd_%1(conn,channel,user,(%3)[(%2) + 2]))))) return 1 // Setup settings here #define IRC_SERVER "irc.gtanet.com" // IRC Server (e.g irc.gtanet.com) #define IRC_PORT 6667 // Set the IRC port (default 6667) // Uncomment line 39 if you want to use 2 bots, uncomment line 40 if you want to use 3 bots #define IRC_AMOUNT1 true //#define IRC_AMOUNT2 true //#define IRC_AMOUNT3 true // Put the names of your irc bot's here (Note: not every bot can have the same name) #define IRC_ECHO_BOT1 "TJT_SAMP" //#define IRC_ECHO_BOT2 "TJT_Serv" //#define IRC_ECHO_BOT3 "TJT_Away" // #channel is the channel you want to echo in game chat in, change it. #define IRC_ECHO_CHAN "#tjt.servertalk" // If your bot names are registered put a password here to identify them with #define IRC_PASSWORD "" // Set the IRC join delay (1000 = 1 second), set to 0 if you dont want to use it // (IF bot has a vHost then set this to 5000 ELSE it wont show the vHost on channel join) #define IRC_JOIN_DELAY 1 // PRETTY SELF EXPLANARY #define IRC_QUIT_MSG "TJT Server SAMP Bot Have A Nice Day. :)" #define IRC_AUTH_MSG "Your not authorized :)" #define IRC_INTI_MSG1 "Hello :)" #define IRC_INTI_MSG2 "Hey :)" #define IRC_INTI_MSG3 "Whats up :)" native ircGetUserLevel(conn, channel[], user[], dest[]); native ircGetUserList(conn, channel[], dest[], size); native ircSetMode(conn, channel[], modes[], nicks[]); native ircConnect(server[], port, user[]); native ircSay(conn, channel[], message[]); native ircSendRawData(conn, rawdata[]); native ircJoinChan(conn, channel[]); native ircPartChan(conn, channel[]); native ircDisconnect(conn); native ircPollEvents(); forward ircOnUserSay(conn, channel[], user[], message[]); forward ircOnUserPart(conn, channel[], user[]); forward ircOnUserJoin(conn, channel[], user[]); forward Float:GetDistanceBetweenPlayers(p1,p2); forward EchoConnectionCheck(); forward IrcPollEventsTimer(); forward DelayedChannelJoin(); forward ircOnConnect(conn); forward IrcSay(Message[]); stock EchoConnection[3], EchoBot = 0, ConnE, Echo_Paused = 0; // Simon new aWeaponNames[][32] = { {"Unarmed (Fist)"}, // 0 {"Brass Knuckles"}, // 1 {"Golf Club"}, // 2 {"Night Stick"}, // 3 {"Knife"}, // 4 {"Baseball Bat"}, // 5 {"Shovel"}, // 6 {"Pool Cue"}, // 7 {"Katana"}, // 8 {"Chainsaw"}, // 9 {"Purple Dildo"}, // 10 {"Big White Vibrator"}, // 11 {"Medium White Vibrator"}, // 12 {"Small White Vibrator"}, // 13 {"Flowers"}, // 14 {"Cane"}, // 15 {"Grenade"}, // 16 {"Teargas"}, // 17 {"Molotov"}, // 18 {" "}, // 19 {" "}, // 20 {" "}, // 21 {"Colt 45"}, // 22 {"Colt 45 (Silenced)"}, // 23 {"Desert Eagle"}, // 24 {"Normal Shotgun"}, // 25 {"Sawnoff Shotgun"}, // 26 {"Combat Shotgun"}, // 27 {"Micro Uzi (Mac 10)"}, // 28 {"MP5"}, // 29 {"AK47"}, // 30 {"M4"}, // 31 {"Tec9"}, // 32 {"Country Rifle"}, // 33 {"Sniper Rifle"}, // 34 {"Rocket Launcher"}, // 35 {"Heat-Seeking Rocket Launcher"}, // 36 {"Flamethrower"}, // 37 {"Minigun"}, // 38 {"Satchel Charge"}, // 39 {"Detonator"}, // 40 {"Spray Can"}, // 41 {"Fire Extinguisher"}, // 42 {"Camera"}, // 43 {"Night Vision Goggles"}, // 44 {"Infrared Vision Goggles"}, // 45 {"Parachute"}, // 46 {"Fake Pistol"} // 47 }; new aDisconnectNames[][16] = { {"Timeout"}, // 0 {"Leaving"}, // 1 {"Kicked"} // 2 }; public OnFilterScriptInit() { print("\t============================================"); print("\tIRC Filterscript"); print("\tBy: Sneaky"); print("\t-"); print("\tLoaded.."); print("\t============================================"); #if defined IRC_AMOUNT1 { EchoConnection[0] = ircConnect(IRC_SERVER, IRC_PORT, IRC_ECHO_BOT1); } #endif #if defined IRC_AMOUNT2 { EchoConnection[1] = ircConnect(IRC_SERVER, IRC_PORT, IRC_ECHO_BOT2); } #endif #if defined IRC_AMOUNT3 { EchoConnection[2] = ircConnect(IRC_SERVER, IRC_PORT, IRC_ECHO_BOT3); } #endif return 1; } public OnFilterScriptExit() { print("\t============================================"); print("\tIRC Filterscript"); print("\tBy: Sneaky"); print("\t-"); print("\tLoaded.."); print("\t============================================"); #if defined IRC_AMOUNT1 { ircSendRawData(EchoConnection[0], "QUIT "IRC_QUIT_MSG""); } #endif #if defined IRC_AMOUNT2 { ircSendRawData(EchoConnection[1], "QUIT "IRC_QUIT_MSG""); } #endif #if defined IRC_AMOUNT3 { ircSendRawData(EchoConnection[2], "QUIT "IRC_QUIT_MSG""); } #endif return 1; } public ircOnConnect(conn) { SetTimer("DelayedChannelJoin",IRC_JOIN_DELAY,0); SetTimer("IrcPollEventsTimer", 500, 1); #if defined IRC_AMOUNT1 { ircSendRawData(EchoConnection[0], "PRIVMSG NickServ :IDENTIFY "IRC_PASSWORD" "); } #endif #if defined IRC_AMOUNT2 { ircSendRawData(EchoConnection[1], "PRIVMSG NickServ :IDENTIFY "IRC_PASSWORD" "); } #endif #if defined IRC_AMOUNT3 { ircSendRawData(EchoConnection[2], "PRIVMSG NickServ :IDENTIFY "IRC_PASSWORD" "); } #endif return 1; } public IrcPollEventsTimer() { ircPollEvents(); return 1; } public DelayedChannelJoin() { #if defined IRC_AMOUNT1 { ircJoinChan(EchoConnection[0], IRC_ECHO_CHAN); IrcSay("4"IRC_INTI_MSG1""); } #endif #if defined IRC_AMOUNT2 { ircJoinChan(EchoConnection[1], IRC_ECHO_CHAN); IrcSay("4"IRC_INTI_MSG2""); } #endif #if defined IRC_AMOUNT3 { ircJoinChan(EchoConnection[2], IRC_ECHO_CHAN); IrcSay("4"IRC_INTI_MSG3""); } #endif return 1; } public IrcSay(Message[]) return ircSay(BotSwitcher(), IRC_ECHO_CHAN, Message); public OnPlayerText(playerid, text[]) { new tString[128],PlayerName[24]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); if(Echo_Paused == 0) { format(tString, sizeof(tString), "12[%d]7 %s:0 %s", playerid, PlayerName, text); IrcSay(tString); } return 1; } public OnPlayerDeath(playerid, killerid, reason) { new tString[128],pName[128],kName[128]; GetPlayerName(killerid, kName,sizeof(kName)); GetPlayerName(playerid, pName,sizeof(pName)); if(Echo_Paused == 0) { if(reason == 255) { format(tString,sizeof(tString),"3%s died.",pName); IrcSay(tString); } else { format(tString,sizeof(tString),"3%s was killed by %s (Weapon: %s - Distance: %.0f ft)",pName,kName,aWeaponNames[reason],GetDistanceBetweenPlayers(playerid,killerid)); IrcSay(tString); } } return 1; } public OnPlayerConnect(playerid) { new tString[64],PlayerName[24]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); if(Echo_Paused == 0) { format(tString, sizeof(tString), "3%s joined the server.", PlayerName); IrcSay(tString); } return 1; } public OnPlayerDisconnect(playerid, reason) { new tString[64],PlayerName[24]; GetPlayerName(playerid, PlayerName, sizeof(PlayerName)); if(Echo_Paused == 0) { format(tString, sizeof(tString), "3%s has left the server. (%s)", PlayerName, aDisconnectNames[reason]); IrcSay(tString); } return 1; } stock BotSwitcher() { #if defined IRC_AMOUNT1 { switch(EchoBot) { case 0: { ConnE = EchoConnection[0]; EchoBot = 0; } } } #endif #if defined IRC_AMOUNT2 { switch(EchoBot) { case 0: { ConnE = EchoConnection[0]; EchoBot = 1; } case 1: { ConnE = EchoConnection[1]; EchoBot = 0; } } } #endif #if defined IRC_AMOUNT3 { switch(EchoBot) { case 0: { ConnE = EchoConnection[0]; EchoBot = 1; } case 1: { ConnE = EchoConnection[1]; EchoBot = 2; } case 2: { ConnE = EchoConnection[2]; EchoBot = 0; } } } #endif return ConnE; } stock ircIsOp(conn,channel[],user[]) { new ircLevel[4]; ircGetUserLevel(conn, channel, user, ircLevel); if(!strcmp(ircLevel, "~", true,1) || !strcmp(ircLevel, "&", true,1) || !strcmp(ircLevel, "@", true,1)) return 1; return 0; } public ircOnUserSay(conn, channel[], user[], message[]) { if(message[0] != '!') return 1; // Admin (+o / @ | +qo / ~ | +a / &) commands here irccmd(ipause,6,conn,channel,user,message); irccmd(ikick,5,conn,channel,user,message); irccmd(ikill,5,conn,channel,user,message); irccmd(islap,5,conn,channel,user,message); irccmd(isay,4,conn,channel,user,message); irccmd(iban,4,conn,channel,user,message); // Player (N/A | +v | +h / %) commands here irccmd(imsg,4,conn,channel,user,message); irccmd(igetid,6,conn,channel,user,message); return 1; } // Player Commands irccmd_imsg(conn, channel[], user[], params[]) { #pragma unused conn,channel new tString[128]; if(!strlen(params)) return IrcSay("USAGE: !imsg <message>"); format(tString,sizeof(tString), ">> Player from IRC %s: %s", user, params); SendClientMessageToAll(0xFFFFFFAA, tString); IrcSay(tString); return 1; } irccmd_igetid(conn, channel[], user[], params[]) { #pragma unused conn,channel,user new idx,tString[128], param[20], PlayerName[24]; param = strtok(params, idx); if (!strlen(param)) return IrcSay ("USAGE: !igetid <nickname>"); new count = 0; for (new i=0; i<GetMaxPlayers() && count<10; i++) { if (IsPlayerConnected(i)) { GetPlayerName(i, PlayerName, sizeof(PlayerName)); for (new j=0, k=(strlen(PlayerName)-strlen(param)); j<=k; j++) { if (strcmp(param, PlayerName[j], true, strlen(param)) == 0) { format(tString, sizeof(tString), "%s%s(%d), ", tString, PlayerName, i); count++; break; } } } } if (strlen(tString)) { format(tString, sizeof(tString), "Matches: %s", tString); tString[strlen(tString) - 2] = 0; } else { format(tString, sizeof(tString), "No matches for: %s", param); } IrcSay(tString); return 1; } // Admin Commands irccmd_isay(conn, channel[], user[], params[]) { if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG""); new tString[128]; if(!strlen(params)) return IrcSay("USAGE: !imsg <message>"); format(tString,sizeof(tString), ">> Admin from IRC %s: %s", user, params); SendClientMessageToAll(0xFF0000AA, tString); IrcSay(tString); return 1; } irccmd_ipause(conn, channel[], user[], params[]) { #pragma unused params if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG""); if(Echo_Paused == 0) { IrcSay("Paused."); Echo_Paused = 1; } else if(Echo_Paused == 1) { IrcSay("Unpaused."); Echo_Paused = 0; } return 1; } irccmd_iban(conn, channel[], user[], params[]) { if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG""); new ID = strval(params),tString[128], Reason[64],PlayerName[24]; GetPlayerName(ID,PlayerName,sizeof(PlayerName)); if(!IsPlayerConnected(ID)) return IrcSay ("USAGE: !iban <playerid> <reason>"); if(sscanf(params, "dz", ID, Reason)) return IrcSay ("USAGE: !iban <playerid> <reason>"); format(tString,sizeof(tString),"Admin %s (ID: -1) banned %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason); SendClientMessageToAll(0xFF0000AA, tString); IrcSay(tString); BanEx(ID, Reason); return 1; } irccmd_ikick(conn, channel[], user[], params[]) { if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG""); new ID = strval(params),tString[128], Reason[64],PlayerName[24]; GetPlayerName(ID,PlayerName,sizeof(PlayerName)); if(!IsPlayerConnected(ID)) return IrcSay ("USAGE: !iban <playerid> <reason>"); if(sscanf(params, "dz", ID, Reason)) return IrcSay ("USAGE: !ikick <playerid> <reason>"); format(tString,sizeof(tString),"Admin %s (ID: -1) kicked %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason); SendClientMessageToAll(0xFF0000AA, tString); IrcSay(tString); Kick(ID); return 1; } irccmd_ikill(conn, channel[], user[], params[]) { if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG""); new ID = strval(params),tString[128], Reason[64],PlayerName[24]; GetPlayerName(ID,PlayerName,sizeof(PlayerName)); if(!IsPlayerConnected(ID)) return IrcSay ("USAGE: !ikill <playerid> <reason>"); if(sscanf(params, "dz", ID, Reason)) return IrcSay ("USAGE: !ikill <playerid> <reason>"); format(tString,sizeof(tString),"Admin %s (ID: -1) killed %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason); SendClientMessageToAll(0xFF0000AA, tString); IrcSay(tString); SetPlayerHealth(ID,0); return 1; } irccmd_islap(conn, channel[], user[], params[]) { if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG""); new ID = strval(params),tString[128], Reason[64],PlayerName[24]; GetPlayerName(ID,PlayerName,sizeof(PlayerName)); if(!IsPlayerConnected(ID)) return IrcSay ("USAGE: !islap <playerid> <reason>"); if(sscanf(params, "dz", ID, Reason)) return IrcSay ("USAGE: !islap <playerid> <reason>"); format(tString,sizeof(tString),"Admin %s (ID: -1) slapped %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason); SendClientMessageToAll(0xFF0000AA, tString); IrcSay(tString); new Float:x,Float:y,Float:z; GetPlayerPos(ID, x, y, z); SetPlayerPos(ID, x, y, z+10); return 1; } stock sscanf(string[], format[], {Float,_}:...) { new formatPos = 0, stringPos = 0, paramPos = 2, paramCount = numargs(); while (paramPos < paramCount && string[stringPos]) { switch (format[formatPos++]) { case '\0': { return false; } case 'i', 'd': { new neg = 1, num = 0, ch = string[stringPos]; if (ch == '-') { neg = -1; ch = string[++stringPos]; } do { stringPos++; if (ch >= '0' && ch <= '9') { num = (num * 10) + (ch - '0'); } else { return true; } } while ((ch = string[stringPos]) && ch != ' '); setarg(paramPos, 0, num * neg); } case 'h', 'x': { new ch, num = 0; while ((ch = string[stringPos++])) { switch (ch) { case 'x', 'X': { num = 0; continue; } case '0' .. '9': { num = (num << 4) | (ch - '0'); } case 'a' .. 'f': { num = (num << 4) | (ch - ('a' - 10)); } case 'A' .. 'F': { num = (num << 4) | (ch - ('A' - 10)); } case ' ': { break; } default: { return true; } } } setarg(paramPos, 0, num); } case 'c': { setarg(paramPos, 0, string[stringPos++]); } case 'f': { // Secret message, if you see this: HELLO! new tmp[25]; strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2); setarg(paramPos, 0, _:floatstr(tmp)); } case 's', 'z': { new i = 0, ch; if (format[formatPos]) { while ((ch = string[stringPos++]) && ch != ' ') { setarg(paramPos, i++, ch); } if (!i) return true; } else { while ((ch = string[stringPos++])) { setarg(paramPos, i++, ch); } } stringPos--; setarg(paramPos, i, '\0'); } default: { continue; } } while (string[stringPos] && string[stringPos] != ' ') { stringPos++; } while (string[stringPos] == ' ') { stringPos++; } paramPos++; } while (format[formatPos] == 'z') formatPos++; return format[formatPos]; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index, result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } public Float:GetDistanceBetweenPlayers(p1,p2) { new Float:Pos[6]; if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) { return -1.00; } GetPlayerPos(p1,Pos[0],Pos[1],Pos[2]); GetPlayerPos(p2,Pos[3],Pos[4],Pos[5]); return floatsqroot(floatpower(floatabs(floatsub(Pos[3],Pos[0])),2)+floatpower(floatabs(floatsub(Pos[4],Pos[1])),2)+floatpower(floatabs(floatsub(Pos[5],Pos[2])),2)); }
Originally Posted by Oxside
Do you get errors when you comile? Or compile's it fine but something doesn't work.
If it's not compiling please post your errors/warnings here .:P And next time use Pastebin.com Or .ca) |