Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // FEEL FREE TO CHANGE CREDITS OR ANYTHING (LOL) ITS ALL YOURS
- #include <a_samp>
- #include <zcmd>
- #include <irc>
- #include <sscanf2>
- #include <foreach>
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_BLUE 0x0000BBAA
- native IsValidVehicle(vehicleid);
- //------------IRC OPTIONS ----------------------------------------
- #define USE_IRC true // false if you dont want to use irc
- // 1st Echo Bot
- #define BOT_1_NICKNAME "Zombie1"
- #define BOT_1_REALNAME "Bot1_Real_Name"
- #define BOT_1_USERNAME "[email protected]"
- // 2nd Echo Bot
- #define BOT_2_NICKNAME "Zombie2"
- #define BOT_2_REALNAME "Bot2_Real_Name"
- #define BOT_2_USERNAME "[email protected]"
- //All bots password
- #define IRC_BOT_PASSWORD "mypass"
- #define BOT_EMAIL "[email protected]"
- // 3rd Echo Bot
- #define BOT_3_NICKNAME "Zombie3"
- #define BOT_3_REALNAME "Bot3_Real_Name"
- #define BOT_3_USERNAME "[email protected]"
- //Admin Channel password(if you have any)
- #define IRC_ADMINCHANNEL_PASSWORD "mypass"
- #define IRC_SERVER "irc.mibbit.com" //irc network, people usually use irc.tl tho
- #define IRC_PORT (6667) // leave it like this < its used by most or i'd say all networks
- #define IRC_CHANNEL "#MyEchoChannel" //Echo channel for normal users
- #define IRC_ADMINCHANNEL "#MyStaffChannel" //Staff channel
- #define MAX_BOTS (4) // number of bots you're using
- new gBotID[MAX_BOTS],gGroupID, PlayersOnline = 0;
- //----------------------------------------------------------------
- //----------------IRC CallBacks --------------------------------------
- public IRC_OnConnect(botid)
- {
- new string[156];
- printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
- // Join the channel
- if(botid == 1 || botid == 2 || botid == 3)
- {
- //Here the bots send message to network to identify (login)
- IRC_JoinChannel(botid, IRC_CHANNEL);
- format(string,sizeof(string),"PRIVMSG NickServ :identify %s",IRC_BOT_PASSWORD);
- IRC_SendRaw(botid, string);
- IRC_AddToGroup(gGroupID, botid);
- }
- if(botid == 1 || botid == 2 || botid == 3)
- {
- //Here the bots send message to network to identify (login)
- format(string,sizeof(string),"PRIVMSG NickServ :identify %s",IRC_BOT_PASSWORD);
- IRC_SendRaw(botid, string);
- format(string,sizeof(string),"JOIN %s :%s",IRC_ADMINCHANNEL,IRC_ADMINCHANNEL_PASSWORD);
- IRC_SendRaw(botid, string);
- format(string,sizeof(string),"MSG %s :Hello Guise",IRC_ADMINCHANNEL);
- IRC_SendRaw(botid, string);
- format(string,sizeof(string),"MSG %s :Hello Guise",IRC_CHANNEL);
- IRC_SendRaw(botid, string);
- IRC_AddToGroup(gGroupID, botid);
- }
- // Add the bot to the group
- return 1;
- }
- public IRC_OnDisconnect(botid)
- {
- //Usually you wont see this... i've added a script which changes bot name in case there's already someone using your bots name
- //Instead of not connecting at all, it simply changes name
- printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
- if (botid == gBotID[0])
- {
- // Reset the bot ID
- IRC_ChangeNick(botid, "TestBot");
- gBotID[0] = 0;
- // Wait 20 seconds for the first bot
- SetTimerEx("IRC_ConnectDelay", 20000, 0, "d", 1);
- }
- else if (botid == gBotID[1])
- {
- // Reset the bot ID
- IRC_ChangeNick(botid, "TestBot1");
- gBotID[1] = 0;
- // Wait 25 seconds for the second bot
- SetTimerEx("IRC_ConnectDelay", 25000, 0, "d", 2);
- }
- else if (botid == gBotID[2])
- {
- // Reset the bot ID
- IRC_ChangeNick(botid, "TestBot2");
- gBotID[2] = 0;
- // Wait 30 seconds for the third bot
- SetTimerEx("IRC_ConnectDelay", 30000, 0, "d", 3);
- }
- printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
- printf("*** Changing bot name...");
- // Remove the bot from the group
- IRC_RemoveFromGroup(gGroupID, botid);
- return 1;
- }
- public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
- {
- //Whenever a user joins the channel (staff or echo) bot sends him/her welcome message
- //We're using IRC_Notice instead of IRC_Say so that only the user who joined see's the msg
- IRC_Notice(botid, user, "Welcome to DayZ-IRC, check !cmds to get started!");
- return 1;
- }
- //--------------------------------------------------------------------------------------------------------------
- //-------------------------------------------SAMP CALLBACKS------------------------------------------------------
- public OnFilterScriptInit()
- {
- irc_connectoninit();
- PlayersOnline = 0;
- return 1;
- }
- public OnFilterScriptExit()
- {
- IRC_Quit(gBotID[0], "Cya faggots");
- IRC_Quit(gBotID[1], "Cya faggots");
- IRC_Quit(gBotID[2], "Cya faggots");
- IRC_DestroyGroup(gGroupID);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string1[128], PlrIP[16], pname[24];
- GetPlayerName(playerid, pname, sizeof(pname)); // get player name
- GetPlayerIp(playerid, PlrIP, sizeof(PlrIP)); // get player ip
- //Anticheat! disallow website names & ips in name!
- if(FindIP(pname))
- {
- Kick(playerid);
- return 1;
- }
- if(strfind(pname, "www.", true) != -1 || strfind(pname, ".com", true) != -1 || strfind(pname, ".ml", true) != -1 || strfind(pname, ".org", true) != -1 || strfind(pname, ".net", true) != -1)
- {
- KickWithMessage(playerid, "A username that contains www. or .com are not allowed on this server.");
- return 1;
- }
- // now about message
- PlayersOnline++;
- format(string1, sizeof(string1), "10[JOIN] %s[%d] has joined the server.4[%d]", pname,playerid,PlayersOnline);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, string1);
- //Send message to admin channel with player ip!
- format(string1, sizeof(string1), "10[JOIN] %s[%d] has joined the server - (IP): %s", pname, playerid, PlrIP);
- IRC_GroupSay(gGroupID, IRC_ADMINCHANNEL, string1);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayersOnline--;
- new leaveMsg[128], name[MAX_PLAYER_NAME], reasonMsg[20];
- switch(reason)
- {
- case 0: reasonMsg = "Timeout/Crash";
- case 1: reasonMsg = "Leaving";
- case 2: reasonMsg = "Kicked/Banned";
- }
- //We'll send message to echo channel only, if you want to send into admin channel aswell, simply add "IRC_GroupSay(gGroupID, IRC_ADMINCHANNEL, leaveMsg);"
- //before return 1;
- GetPlayerName(playerid, name, sizeof(name));
- format(leaveMsg, sizeof(leaveMsg), "14[PART]%s (%d) Has Left The Server -(%s)[%i]", name, playerid, reasonMsg, PlayersOnline);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, leaveMsg);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if (killerid != INVALID_PLAYER_ID) // we're checking that the killer is a calid player
- {
- new pname[24],
- killername[24],
- string[128];
- GetPlayerName(playerid,pname,sizeof(pname));
- GetPlayerName(killerid,killername,sizeof(killername));
- format(string,sizeof(string),"5[KILL] %s(%d) has been killed by %s(%d) - %s",pname,playerid,killername,killerid, GetDeathReason(reason));
- IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
- }
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- //We'll a code here which prevents people from use caps in game, you can remove it if you wish...
- new i;
- while (text[++i])
- {
- if ('A' <= text[i] <= 'Z') text[i] |= 0x20;
- }
- //now about text
- new wantedlevel;
- wantedlevel = GetPlayerWantedLevel(playerid);
- if(wantedlevel == 0)
- {
- new string[128], pname[24];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(string, sizeof(string), "12[%d] 6%s7[INNOCENT]: 5 %s",playerid, pname, text);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
- }
- else if(wantedlevel > 0)
- {
- new string[128], pname[24];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(string, sizeof(string), "12[%d] 6%s7[WANTED]: 5 %s",playerid, pname, text);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
- }
- return 1;
- }
- //----------------------------------------------IRC COMMANDS-------------------------------------------------
- /*You can change permissions to your likes for commands, here's a small explaination of permissions:
- -IRC_IsOwner (only the user having owner on irc channel can use cmd)
- -IRC_IsAdmin (only the user having admin on irc channel can use cmd)
- -IRC_IsOp (only the user having op on irc channel can use cmd)
- -IRC_IsHalfop(only the user having half-op on irc channel can use cmd)
- -IRC_IsVoice (only the user having voice on irc channel can use cmd)
- */
- IRCCMD:cmds(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsOwner(botid, channel, user))
- {
- IRC_Say(botid, IRC_CHANNEL,"4IRC Commands(at owner level)");
- IRC_Say(botid, IRC_CHANNEL,"12!rcon !say !clearchat !pm !players !warn !giveallcash !admin !spawn !caps !info");
- IRC_Say(botid, IRC_CHANNEL,"12!bjoin !kick !weaps !unban !aall !slap !setcash !setscore !spam !setwanted !contime");
- IRC_Say(botid, IRC_CHANNEL,"12!ban !resapwnalluv !adan !adkill respawnallv !hall !giveallweapon !getid !exit !ppl");
- IRC_Say(botid, IRC_CHANNEL,"12!setname !veh !disarm !showip ");
- }
- return 1;
- }
- IRCCMD:spam(botid, channel[], user[], host[], params[])
- {
- // Check if the user entered any text
- // Echo the formatted message
- if (IRC_IsHalfop(botid, channel, user))
- {
- new msg[112];
- format(msg,sizeof(msg), "[BOT] Please do not Flood or Spam in chat, or else you will be muted!", user, params);
- SendClientMessageToAll(COLOR_RED, msg);
- format(msg, sizeof(msg),"2[PBOT] Please do not Flood or Spam in chat, or else you will be muted!", user, params);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
- return 1;
- }
- return 1;
- }
- IRCCMD:caps(botid, channel[], user[], host[], params[])
- {
- // Check if the user entered any text
- // Echo the formatted message
- if (IRC_IsHalfop(botid, channel, user))
- {
- new msg[112];
- format(msg,sizeof(msg), "[BOT] Please turn off your caps, or else you will be muted!", user, params);
- SendClientMessageToAll(COLOR_RED, msg);
- format(msg, sizeof(msg),"2[PBOT] Please turn off your caps, or else you will be muted!", user, params);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
- return 1;
- }
- return 1;
- }
- IRCCMD:rcon(botid, channel[], user[], host[], params[])
- {
- // Check if the user is at least an op in the channel
- if (IRC_IsOwner(botid, channel, user))
- {
- // Check if the user entered any text
- if (!isnull(params))
- {
- // Check if the user did not enter any invalid commands
- if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
- {
- // Echo the formatted message
- new msg[128];
- format(msg, sizeof(msg), "RCON command %s has been executed.", params);
- IRC_GroupSay(gGroupID, channel, msg);
- // Send the command
- SendRconCommand(params);
- }
- }
- }
- return 1;
- }
- // restart server
- IRCCMD:exit(botid, channel[], user[], host[], params[])
- {
- new string[24];
- // Check if the user is at least an op in the channel
- if (IRC_IsOwner(botid, channel, user))
- {
- format(string, sizeof(string), "EXIT CMD BY %s",user);
- IRC_Quit(gBotID[0], string);
- IRC_Quit(gBotID[1], string);
- IRC_Quit(gBotID[2], string);
- IRC_DestroyGroup(gGroupID);
- SendRconCommand("gmx");
- IRC_Say(botid, IRC_CHANNEL, "EXIT");
- }
- return 1;
- }
- // check player packetloss
- IRCCMD:ppl(botid, channel[], user[], host[], params[])
- {
- new string[128], otherID, othername[24];
- if(IRC_IsHalfop(botid, channel, user))
- {
- if(sscanf(params, "d", otherID))
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!ppl <player / ID>\"");
- }
- else
- {
- GetPlayerName(otherID, othername, sizeof(othername));
- format(string,sizeof(string),"8[PACKETLOSS] Player %s's packets loss: %.2f percent.",othername,NetStats_PacketLossPercent(otherID));
- IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
- }
- }
- else
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10You must be halfop to use this command.");
- }
- return 1;
- }
- //Check for how many mins has the player been connected to server.
- IRCCMD:contime(botid, channel[], user[], host[], params[])
- {
- new string[128], otherID, othername[24];
- if(IRC_IsHalfop(botid, channel, user))
- {
- if(sscanf(params, "d", otherID))
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!contime <player / ID>\"");
- }
- else
- {
- new seconds = NetStats_GetConnectedTime(otherID) / 1000;
- new minutes = seconds / 60;
- GetPlayerName(otherID, othername, sizeof(othername));
- format(string,sizeof(string),"3[Connted Time] Player %s has been connected for: %i minutes.",othername,minutes);
- IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
- }
- }
- else
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10You must be halfop to use this command.");
- }
- return 1;
- }
- //This command comes with level by chat in game & with a anti advertisement via irc!
- IRCCMD:say(botid, channel[], user[], host[], params[])
- {
- if (!isnull(params))
- {
- if(IRC_IsOwner(botid, channel, user))
- {
- // Echo the formatted message
- new msg[112];
- format(msg,sizeof(msg), "(IRC-Owner)%s: %s", user, params);
- SendClientMessageToAll(COLOR_GREEN, msg);
- format(msg, sizeof(msg),"4(IRC-Owner) %s:1%s", user, params);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- else if(IRC_IsAdmin(botid, channel, user))
- {
- // Echo the formatted message
- new msg[112];
- format(msg,sizeof(msg), "(IRC-High_Admin)%s: %s", user, params);
- SendClientMessageToAll(COLOR_GREEN, msg);
- format(msg, sizeof(msg),"4(IRC-High_Admin) %s:1%s", user, params);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- else if(IRC_IsOp(botid, channel, user))
- {
- if (FindIP(params) || strfind(params, "www.", true) != -1 || strfind(params, ".tk", true) != -1 || strfind(params, ".com", true) != -1 || strfind(params, ".ml", true) != -1 || strfind(params, ".org", true) != -1 || strfind(params, ".net", true) != -1)
- {
- IRC_GroupSay(gGroupID, IRC_CHANNEL, "4[SPAM] Advert detected! If this occurs frequently, you will be kicked.");
- return 0;
- }
- // Echo the formatted message
- new msg[112];
- format(msg,sizeof(msg), "(IRC-Admin)%s: %s", user, params);
- SendClientMessageToAll(COLOR_GREEN, msg);
- format(msg, sizeof(msg),"4(IRC-Admin) %s:1%s", user, params);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- else if(IRC_IsHalfop(botid, channel, user))
- {
- if (FindIP(params) || strfind(params, "www.", true) != -1 || strfind(params, ".tk", true) != -1 || strfind(params, ".com", true) != -1 || strfind(params, ".ml", true) != -1 || strfind(params, ".org", true) != -1 || strfind(params, ".net", true) != -1)
- {
- IRC_GroupSay(gGroupID, IRC_CHANNEL, "4[SPAM] Advert detected! If this occurs frequently, you will be kicked.");
- return 0;
- }
- // Echo the formatted message
- new msg[112];
- format(msg,sizeof(msg), "(IRC-Mod)%s: %s", user, params);
- SendClientMessageToAll(COLOR_GREEN, msg);
- format(msg, sizeof(msg),"12(IRC-Mod) %s:1%s", user, params);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- else
- {
- if (FindIP(params) || strfind(params, "www.", true) != -1 || strfind(params, ".tk", true) != -1 || strfind(params, ".com", true) != -1 || strfind(params, ".ml", true) != -1 || strfind(params, ".org", true) != -1 || strfind(params, ".net", true) != -1)
- {
- IRC_GroupSay(gGroupID, IRC_CHANNEL, "4[SPAM] Advert detected! If this occurs frequently, you will be kicked.");
- return 0;
- }
- // Echo the formatted message
- new msg[112];
- format(msg,sizeof(msg), "(IRC)%s: %s", user, params);
- SendClientMessageToAll(COLOR_GREEN, msg);
- format(msg, sizeof(msg),"4(IRC)%s:1%s", user, params);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- }
- return 1;
- }
- // talk as admin
- IRCCMD:admin(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsHalfop(botid, channel, user))
- {
- if (!isnull(params))
- {
- new msg[112];
- format(msg,sizeof(msg), "Admin on IRC: %s", params);
- SendClientMessageToAll(COLOR_GREEN, msg);
- format(msg,sizeof(msg), "Admin on IRC: %s", params);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- }
- return 1;
- }
- IRCCMD:players(botid, channel[], user[], host[], params[]) // not taking from anyone, selfmade, remember PlayerOnline ?
- {
- new string[80];
- format(string, sizeof(string), "Players Online: %i",PlayersOnline);
- IRC_GroupSay(gGroupID, channel, string);
- return 1;
- }
- IRCCMD:pm(botid, channel[], user[], host[], params[]) {
- new str[128], str2[128], id, pname[24];
- if(sscanf(params,"ds[128]", id, str2)) return IRC_GroupSay(gGroupID, IRC_CHANNEL,"10Usage:!pm [id] [message]");
- if(IsPlayerConnected(id))
- {
- GetPlayerName(id, pname, sizeof(pname));
- format(str, sizeof(str),"12PM to [%d]%s: %s", id, pname, str2);
- IRC_GroupSay(gGroupID, channel, str);
- format(str, sizeof(str),"[IRC PM]%s: %s", user, str2);
- SendClientMessage(id, COLOR_GREEN, str);
- }else return IRC_GroupSay(gGroupID, IRC_CHANNEL,"11,10Player is not connected Right Now");
- return 1;
- }
- IRCCMD:adan(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsOp(botid, channel, user))
- {
- if (!isnull(params))
- {
- new msg[112];
- format(msg,sizeof(msg), "%s", params);
- GameTextForAll(msg, 7000, 3);
- format(msg,sizeof(msg), "12[ANNOUNCEMENT by %s] %s", user, params);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- }
- return 1;
- }
- IRCCMD:clearchat(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsHalfop(botid, channel, user))
- {
- for(new i = 0; i < 50; i++)
- {
- SendClientMessageToAll(COLOR_WHITE," ");
- }
- SendClientMessageToAll(COLOR_WHITE, "{A9C4E4}An administrator has cleared the chat.");
- }
- else
- {
- return 0;
- }
- return 1;
- }
- IRCCMD:giveallcash(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsAdmin(botid, channel, user))
- {
- new amount, message[128];
- if(sscanf(params, "i", amount))
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!giveallcash <amount>\"");
- }
- else
- {
- if (amount > 0)
- {
- foreach(Player, i)
- {
- GivePlayerMoney(i, amount);
- }
- format(message, sizeof(message), "{A9C4E4}All players have been given {FFFFFF}$%s by %s", FormatNumber(amount), user);
- SendClientMessageToAll(COLOR_WHITE, message);
- }
- else
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] The amount must be greater than 0.");
- }
- }
- }
- else
- {
- return 0;
- }
- return 1;
- }
- IRCCMD:giveallweapon(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsAdmin(botid, channel, user))
- {
- new weapID, weapAmmo, message[128];
- if(sscanf(params, "ii", weapID, weapAmmo))
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL, "11,10Usage: \"!giveallweapon <weaponID> <weaponAmmo>\"");
- }
- else
- {
- if(weapID < 1 || weapID > 46)
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] {FFFFFF}Weapon ID should be between 1 and 46.");
- }
- else
- {
- if(weapAmmo < 1 || weapAmmo > 600)
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] {FFFFFF}Weapon ammo should be between 1 and 600.");
- }
- else
- {
- switch(weapID)
- {
- case 16, 35, 36, 37, 38, 39, 40, 43, 44, 45:
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] {FFFFFF}You cannot give this weapon to all players.");
- }
- }
- foreach(Player, i)
- {
- GivePlayerWeapon(i, weapID, weapAmmo);
- }
- format(message, sizeof(message), "{A9C4E4}An administrator has given everyone a %W with %i ammo.", weapID, weapAmmo);
- SendClientMessageToAll(COLOR_WHITE, message);
- IRC_GroupSay(gGroupID, channel, message);
- }
- }
- }
- }
- else
- {
- return 0;
- }
- return 1;
- }
- IRCCMD:getid(botid, channel[], user[], host[], params[])
- {
- new namepart[24];
- if(sscanf(params, "s[24]", namepart))
- return IRC_GroupSay(gGroupID,IRC_CHANNEL, "11,10Usage: /getid <part of nickname>");
- new found, string[128], playername[MAX_PLAYER_NAME];
- format(string,sizeof(string),"12Searching for: %s", namepart);
- IRC_Say(botid, IRC_CHANNEL,string);
- foreach(Player, i)
- {
- GetPlayerName(i, playername, MAX_PLAYER_NAME);
- new namelen = strlen(playername);
- new bool:searched=false;
- for(new pos=0; pos <= namelen; pos++)
- {
- if(searched != true)
- {
- if(strfind(playername,namepart,true) == pos)
- {
- found++;
- format(string,sizeof(string),"12%d. %s (ID %d)", found, playername, i);
- IRC_Say(botid, IRC_CHANNEL, string);
- searched = true;
- }
- }
- }
- }
- if(found == 0) return IRC_Say(botid, IRC_CHANNEL, "4No players have this in their nickname");
- return 1;
- }
- IRCCMD:adkill(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsOp(botid, channel, user))
- {
- new otherID, otherName[24];
- if(sscanf(params, "d", otherID))
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!adkill <playername/id>\"");
- }
- else
- {
- if(IsPlayerConnected(otherID))
- {
- GetPlayerName(otherID, otherName, sizeof(otherName));
- new message[128];
- format(message, sizeof(message), "[ADMIN] You have slain %s(%i)!", otherName, otherID);
- IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
- SendClientMessage(otherID, COLOR_WHITE, "{A9C4E4}An administrator has killed you.");
- SetPlayerHealth(otherID, 0);
- }
- else
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] That player is not online!");
- }
- }
- }
- else
- {
- return 0;
- }
- return 1;
- }
- IRCCMD:setscore(botid, channel[], user[], host[], params[])
- {
- new score, otherName[24], target, message[128];
- if(IRC_IsAdmin(botid, channel, user))
- {
- if(sscanf(params, "iu",target,score))
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <score>");
- }
- else
- {
- GetPlayerName(target, otherName, sizeof(otherName));
- SetPlayerScore(target, score);
- format(message, sizeof(message), "11,10[ADMIN] You set %s's score to %i", otherName, score);
- IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
- format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your score has been set to {FFDC2E}%i", score);
- SendClientMessage(target, COLOR_WHITE, message);
- }
- }
- else
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
- }
- return 1;
- }
- IRCCMD:setcash(botid, channel[], user[], host[], params[])
- {
- new cash, otherName[24], target, message[128];
- if(IRC_IsAdmin(botid, channel, user))
- {
- if(sscanf(params, "iu",target,cash))
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <cash>");
- }
- else
- {
- GetPlayerName(target, otherName, sizeof(otherName));
- GivePlayerMoney(target, cash);
- format(message, sizeof(message), "11,10[ADMIN] You set %s's cash to %i", otherName, cash);
- IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
- format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your cash has been set to {FFDC2E}%i", cash);
- SendClientMessage(target, COLOR_WHITE, message);
- }
- }
- else
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
- }
- return 1;
- }
- IRCCMD:setwanted(botid, channel[], user[], host[], params[])
- {
- new wanted, otherName[24], target, message[128];
- if(IRC_IsAdmin(botid, channel, user))
- {
- if(sscanf(params, "iu",target,wanted))
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <wanted>");
- }
- else
- {
- GetPlayerName(target, otherName, sizeof(otherName));
- SetPlayerWantedLevel(target, wanted);
- format(message, sizeof(message), "11,10[ADMIN] You set %s's wanted to %i", otherName, wanted);
- IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
- format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your wanted has been set to {FFDC2E}%i", wanted);
- SendClientMessage(target, COLOR_WHITE, message);
- }
- }
- else
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
- }
- return 1;
- }
- IRCCMD:setname(botid, channel[], user[], host[], params[])
- {
- new name[24], otherName[24], target, message[128];
- if(IRC_IsAdmin(botid, channel, user))
- {
- if(sscanf(params, "is[24]",target,name))
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <name>");
- }
- else
- {
- GetPlayerName(target, otherName, sizeof(otherName));
- SetPlayerName(target, name);
- format(message, sizeof(message), "11,10[ADMIN] You set %s's name to %s", otherName, name);
- IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
- format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your name has been set to {FFDC2E}%s", name);
- SendClientMessage(target, COLOR_WHITE, message);
- }
- }
- else
- {
- IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
- }
- return 1;
- }
- IRCCMD:veh(botid, channel[], user[], host[], params[])
- {
- new target, targetname[24], car;
- if(IRC_IsOp(botid, channel, user))
- {
- new Float:X, Float:Y, Float:Z, Vehicle;
- if(sscanf(params,"ui", target,car)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !Veh <userid/name> <Vehicle ID 400 - 611>");
- if(car < 400 || car > 611) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "ERROR: Cannot go under 400 or above 611.");
- if(car == 520 && strcmp(user, "YourName",true) != 0 || car == 425 && strcmp(user, "Someone Else's name",true) != 0)
- {
- return IRC_GroupSay(gGroupID,IRC_CHANNEL, "This vehicle is reserved for the boss");
- }
- GetPlayerName(target, targetname, sizeof(targetname));
- GetPlayerPos(target, X, Y, Z);
- Vehicle = CreateVehicle(car, X, Y, Z + 2.0, 0, 0, 0, -1);
- PutPlayerInVehicle(target, Vehicle, 0);
- IRC_GroupSay(gGroupID, channel, "Vehicle has been given succesfully!");
- }
- return 1;
- }
- IRCCMD:disarm(botid, channel[], user[], host[], params[])
- {
- new target;
- if(IRC_IsOp(botid, channel, user))
- {
- if(sscanf(params,"i", target)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !disarm <userid/name>");
- ResetPlayerWeapons(target);
- IRC_GroupSay(gGroupID, channel, "You have succesfully removed player's weapons!");
- }
- return 1;
- }
- IRCCMD:showip(botid, channel[], user[], host[], params[])
- {
- new target, plrIP[16], string[128];
- if(IRC_IsHalfop(botid, channel, user))
- {
- if(sscanf(params,"i", target)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !showip <userid/name>");
- GetPlayerIp(target, plrIP, sizeof(plrIP));
- format(string, sizeof(string), "[IP REQUESTED BY %s]Player's IP: %s",user,plrIP);
- IRC_GroupSay(gGroupID, channel, string);
- }
- return 1;
- }
- IRCCMD:warn(botid, channel[], user[], host[], params[]) {
- if (IRC_IsHalfop(botid, channel, user))
- {
- new endid, reason[24], pname[24];
- if(sscanf(params,"is[24]", endid, reason))return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10JikyBot: 11,10Usage:!warn [playerid] [reason]");
- new str[128];
- if(IsPlayerConnected(endid) && endid != INVALID_PLAYER_ID)
- {
- if (IRC_IsHalfop(botid, channel, user))
- {
- GetPlayerName(endid, pname, 24);
- format(str, sizeof (str), "*Administrator \"%s\" has warned \"%s\". (Warning: %d/%d)***", user, pname);
- SendClientMessageToAll(COLOR_RED, str);
- format(str, sizeof (str), "[Reason: %s]", reason);
- SendClientMessageToAll(COLOR_RED, str);
- format(str, sizeof (str), "*11,10Administrator \"%s\" has warned \"%s\". ***", user, pname);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
- format(str, sizeof (str), "11,10[Reason: %s]", reason);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
- format(str, 9909, "{FF7E19}Name: %s\n{00F700}Admin: %s\n{E10000}Reason: %s\n",pname,user,reason);
- ShowPlayerDialog(endid, 9909, DIALOG_STYLE_MSGBOX, "{00F700}Warned", str, "Close", "");
- }
- return 1;
- } else return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10JikyBot: Player is not connected");
- } else return IRC_GroupSay(gGroupID, IRC_CHANNEL,"11,10[LEVEL-INFO]:Invalid command! use /commands or /cmds to check full list.");
- }
- IRCCMD:weaps(botid, channel[], user[], host[], params[]) {
- if (IRC_IsHalfop(botid, channel, user))
- {
- if(isnull(params)) return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11 Usage:/weaps [playerid]");
- new player1, string[128], string2[64], WeapName[24], slot, weap, ammo, wh, x, pname[24];
- player1 = strval(params);
- GetPlayerName(player1, pname, 24);
- if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
- format(string2,sizeof(string2),"11,10[>> %s Weapons (id:%d) <<]", pname, player1); IRC_GroupSay(gGroupID, IRC_CHANNEL, string2);
- for (slot = 0; slot < 14; slot++) { GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) wh++; }
- if(wh < 1) return IRC_GroupSay(gGroupID, IRC_CHANNEL,"Player has no weapons");
- if(wh >= 1)
- {
- for (slot = 0; slot < 14; slot++)
- {
- GetPlayerWeaponData(player1, slot, weap, ammo);
- if( ammo != 0 && weap != 0)
- {
- GetWeaponName(weap, WeapName, sizeof(WeapName) );
- if(ammo == 65535 || ammo == 1) format(string,sizeof(string),"%s%s (1)",string, WeapName );
- else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo );
- x++;
- if(x >= 5)
- {
- IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
- x = 0;
- format(string, sizeof(string), "");
- }
- else format(string, sizeof(string), "%s, ", string);
- }
- }
- if(x <= 4 && x > 0) {
- string[strlen(string)-3] = '.';
- IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
- }
- }
- return 1;
- } else return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10Player is not connected");
- } else return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10[LEVEL-INFO]:Invalid command! use /commands or /cmds to check full list.");
- }
- IRCCMD:kick(botid, channel[], user[], host[], params[])
- {
- new target, reason[30], str[128], pname[24];
- if(IRC_IsOp(botid, channel, user))
- {
- if(sscanf(params,"is[30]", target,reason)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !kick <userid/name> <reason>");
- GetPlayerName(target, pname, 24);
- format(str, sizeof(str), "IRC Admin %s has kicked %s(%i) from the server[REASON: %s]",user, pname, target, reason);
- SendClientMessageToAll(COLOR_RED, str);
- IRC_GroupSay(gGroupID, channel, str);
- Kick(target);
- }
- return 1;
- }
- IRCCMD:ban(botid, channel[], user[], host[], params[])
- {
- new target, reason[30], str[128], pname[24];
- if(IRC_IsOp(botid, channel, user))
- {
- if(sscanf(params,"is[30]", target,reason)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !ban <userid/name> <reason>");
- GetPlayerName(target, pname, 24);
- format(str, sizeof(str), "IRC Admin %s has banned %s(%i) from the server[REASON: %s]",user, pname, target, reason);
- SendClientMessageToAll(COLOR_RED, str);
- IRC_GroupSay(gGroupID, channel, str);
- Ban(target);
- }
- return 1;
- }
- IRCCMD:hall(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsHalfop(botid, channel, user))
- {
- foreach(Player, i)
- {
- if(IsPlayerConnected(i))
- {
- SetPlayerHealth(i, 100);
- }
- }
- }
- return 1;
- }
- IRCCMD:aall(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsHalfop(botid, channel, user))
- {
- foreach(Player, i)
- {
- if(IsPlayerConnected(i))
- {
- SetPlayerArmour(i, 100);
- }
- }
- }
- return 1;
- }
- IRCCMD:resawpnallv(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsOp(botid, channel, user))
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- if(IsValidVehicle(i))
- {
- SetVehicleToRespawn(i);
- }
- }
- SendClientMessageToAll(COLOR_WHITE, "{A9C4E4}An administrator has respawned server vehicles.");
- IRC_GroupSay(gGroupID, channel, "An IRC administrator has respawned server vehicles.");
- }
- return 1;
- }
- IRCCMD:resawpnalluv(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsOp(botid, channel, user))
- {
- for(new i = 0; i < MAX_VEHICLES; i++)
- {
- if(!IsVehicleOccupied(i))
- {
- SetVehicleToRespawn(i);
- }
- }
- SendClientMessageToAll(COLOR_WHITE, "{A9C4E4}An administrator has respawned server unused vehicles.");
- IRC_GroupSay(gGroupID, channel, "An IRC administrator has respawned server unused vehicles.");
- }
- return 1;
- }
- IRCCMD:explode(botid, channel[], user[], host[], params[])
- {
- new target;
- if(IRC_IsOp(botid, channel, user))
- {
- if(sscanf(params,"i", target)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !explode <userid/name>");
- new Float:dX, Float:dY, Float:dZ;
- GetPlayerPos(target, dX, dY, dZ);
- CreateExplosion(dX, dY, dZ, 12, 1.0);
- new otherName[24];
- GetPlayerName(target, otherName, sizeof(otherName));
- new log[250];
- format(log, sizeof(log), "%s(%i) has exploded %s(%i)", user, otherName, target);
- IRC_GroupSay(gGroupID, channel, log);
- }
- return 1;
- }
- IRCCMD:info(botid, channel[], user[], host[], params[])
- {
- // Check if the user is at least an op in the channel
- new strmessage[950], hostname[40], port;
- GetServerVarAsString("hostname", hostname, sizeof(hostname));
- port = GetServerVarAsInt("port");
- format(strmessage, sizeof(strmessage), "6[Server INFO]");
- IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
- format(strmessage, sizeof(strmessage), "6[Server Ip]Your_Server_IP:%d",port);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
- format(strmessage, sizeof(strmessage), "6[HOSTNAME] %s",hostname);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
- format(strmessage, sizeof(strmessage), "6[Version]: YOUR_VERSION");
- IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
- format(strmessage, sizeof(strmessage), "6[Website]: YOUR_WEBSITE");
- IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
- return true;
- }
- //--------------------------------IN GAME COMMANDS---------------------------------------------------
- COMMAND:quitbots(playerid, params[])
- {
- new pname[24], string[24];
- GetPlayerName(playerid, pname, sizeof(pname));
- if(IsPlayerAdmin(playerid))
- {
- format(string, sizeof(string), "EXIT CMD BY %s(%d)",pname, playerid);
- IRC_Quit(gBotID[0], string);
- IRC_Quit(gBotID[1], string);
- IRC_Quit(gBotID[2], string);
- IRC_DestroyGroup(gGroupID);
- }
- return 1;
- }
- COMMAND:getbots(playerid, params[])
- {
- if(IsPlayerAdmin(playerid))
- {
- gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
- IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
- gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
- IRC_SetIntData(gBotID[1], E_IRC_CONNECT_DELAY, 30);
- gBotID[2] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_3_NICKNAME, BOT_3_REALNAME, BOT_3_USERNAME);
- IRC_SetIntData(gBotID[2], E_IRC_CONNECT_DELAY, 30);
- gGroupID = IRC_CreateGroup();
- }
- return 1;
- }
- CMD:irc(playerid, params[])
- {
- new string[128];
- new pname[24];
- if(!strlen(params))
- {
- SendClientMessage(playerid,COLOR_GREEN,"USAGE: /ircpm (Message)");
- return 1;
- }
- GetPlayerName(playerid, pname, sizeof(pname));
- format(string, sizeof(string), "7,1IRC PM: %s(%d): %s",pname,playerid,params);
- IRC_GroupSay(gGroupID, IRC_CHANNEL,string);
- format(string, sizeof(string), "[IRC PM] %s(%d): %s",pname,playerid,params);
- SendClientMessage(playerid,COLOR_GREEN,string);
- return 1;
- }
- //--------------------------------FUNCTIONS----------------------------------------------------------------------
- //This goes on FS/GM init
- forward irc_connectoninit();
- public irc_connectoninit()
- {
- gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
- IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
- gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
- IRC_SetIntData(gBotID[1], E_IRC_CONNECT_DELAY, 30);
- gBotID[2] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_3_NICKNAME, BOT_3_REALNAME, BOT_3_USERNAME);
- IRC_SetIntData(gBotID[2], E_IRC_CONNECT_DELAY, 30);
- gGroupID = IRC_CreateGroup();
- }
- // Get weapon name
- stock GetDeathReason(reason)
- {
- new deathreason[32];
- switch(reason)
- {
- case 0: deathreason = "Fists";
- case 1: deathreason = "Brass Knuckles";
- case 2: deathreason = "Golf Stick";
- case 3: deathreason = "Nite Stick";
- case 4: deathreason = "Knife";
- case 5: deathreason = "Baseball Bat";
- case 6: deathreason = "Shovel";
- case 7: deathreason = "Pool Cue";
- case 8: deathreason = "Katana";
- case 9: deathreason = "Chainsaw";
- case 10: deathreason = "Dildo";
- case 11: deathreason = "Small Vibrator";
- case 12: deathreason = "Large Vibrator";
- case 13: deathreason = "Vibrator";
- case 14: deathreason = "Flowers";
- case 15: deathreason = "Cane";
- case 16: deathreason = "Grenade";
- case 17: deathreason = "Smoke Grenade";
- case 18: deathreason = "Molotov Cocktail";
- case 19: deathreason = "Vehicle Weapon";
- case 20: deathreason = "Hydra Flare";
- case 21: deathreason = "Jetpack";
- case 22: deathreason = "9mm Pistol";
- case 23: deathreason = "Silenced 9mm Pistol";
- case 24: deathreason = "Desert Eagle";
- case 25: deathreason = "Shotgun";
- case 26: deathreason = "Sawnoff Shotgun";
- case 27: deathreason = "Combat Shotgun";
- case 28: deathreason = "Micro SMG";
- case 29: deathreason = "MP5";
- case 30: deathreason = "AK47";
- case 31: deathreason = "M4";
- case 32: deathreason = "Tec-9";
- case 33: deathreason = "Rifle";
- case 34: deathreason = "Sniper Rifle";
- case 35: deathreason = "Rocket Launcherr";
- case 36: deathreason = "Rocket Launcher";
- case 37: deathreason = "Flamethrower";
- case 38: deathreason = "Minigun";
- case 39: deathreason = "Satchels";
- case 40: deathreason = "Detonator";
- case 41: deathreason = "Spraycan";
- case 42: deathreason = "Fire Extinguisher";
- case 43: deathreason = "Camera";
- case 44: deathreason = "Nightvision Goggles";
- case 45: deathreason = "Infrared Goggles";
- case 46: deathreason = "Parachute";
- case 47: deathreason = "!>>> Unknown 47 <<<!";
- case 48: deathreason = "!>>> Unknown 48 <<<!";
- case 49: deathreason = "Vehicle";
- case 50: deathreason = "Helicopter Blades";
- case 51: deathreason = "Explosion";
- case 52: deathreason = "!>>> Unknown 52 <<<!";
- case 53: deathreason = "!>>> Unknown 53 <<<!";
- case 54: deathreason = "!>>> Unknown 54 <<<!";
- case 55: deathreason = "!>>> Unknown 55 <<<!";
- case 255: deathreason = "!>>> Unknown 255 <<<!";
- }
- return deathreason;
- }
- stock KickWithMessage(playerid, message[])
- {
- SendClientMessage(playerid, COLOR_RED, message);
- SetTimerEx("KickPublic", 1000, 0, "d", playerid);
- }
- forward KickPublic(playerid);
- public KickPublic(playerid)
- {
- Kick(playerid);
- }
- stock FindIP(text[])
- {
- new strR[255];
- new is1=0;
- new r=0;
- while(strlen(text[is1]))
- {
- if('0'<=text[is1]<='9')
- {
- new is2=is1+1;
- new p=0;
- while(p==0)
- {
- if('0'<=text[is2]<='9'&&strlen(text[is2])) is2++;
- else
- {
- strmid(strR[r],text,is1,is2,255);
- if(strval(strR[r])<255) r++;
- is1=is2;
- p=1;
- }
- }
- }
- is1++;
- }
- if(r>=4)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- stock FormatNumber(iNum, const szChar[] = ",")
- {
- new
- szStr[16]
- ;
- format(szStr, sizeof(szStr), "%d", iNum);
- for(new iLen = strlen(szStr) - 3; iLen > 0; iLen -= 3)
- {
- strins(szStr, szChar, iLen);
- }
- return szStr;
- }
- stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
- {
- foreach(Player,i)
- {
- if(IsPlayerInAnyVehicle(i))
- {
- if(GetPlayerVehicleID(i)==vehicleid)
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
- }
- return 1;
- }
- //---------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment