Guest User

J-IRC script

a guest
Oct 26th, 2016
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.63 KB | None | 0 0
  1. // FEEL FREE TO CHANGE CREDITS OR ANYTHING (LOL) ITS ALL YOURS
  2.  
  3. #include <a_samp>
  4. #include <zcmd>
  5. #include <irc>
  6. #include <sscanf2>
  7. #include <foreach>
  8.  
  9. #define COLOR_GREY 0xAFAFAFAA
  10. #define COLOR_GREEN 0x33AA33AA
  11. #define COLOR_RED 0xAA3333AA
  12. #define COLOR_YELLOW 0xFFFF00FF
  13. #define COLOR_WHITE 0xFFFFFFFF
  14. #define COLOR_BLUE 0x0000BBAA
  15. native IsValidVehicle(vehicleid);
  16.  
  17. //------------IRC OPTIONS ----------------------------------------
  18.  
  19. #define USE_IRC true // false if you dont want to use irc
  20. // 1st Echo Bot
  21. #define BOT_1_NICKNAME "Zombie1"
  22. #define BOT_1_REALNAME "Bot1_Real_Name"
  23. #define BOT_1_USERNAME "[email protected]"
  24. // 2nd Echo Bot
  25. #define BOT_2_NICKNAME "Zombie2"
  26. #define BOT_2_REALNAME "Bot2_Real_Name"
  27. #define BOT_2_USERNAME "[email protected]"
  28. //All bots password
  29. #define IRC_BOT_PASSWORD "mypass"
  30. #define BOT_EMAIL "[email protected]"
  31. // 3rd Echo Bot
  32. #define BOT_3_NICKNAME "Zombie3"
  33. #define BOT_3_REALNAME "Bot3_Real_Name"
  34. #define BOT_3_USERNAME "[email protected]"
  35.  
  36. //Admin Channel password(if you have any)
  37. #define IRC_ADMINCHANNEL_PASSWORD "mypass"
  38.  
  39. #define IRC_SERVER "irc.mibbit.com" //irc network, people usually use irc.tl tho
  40. #define IRC_PORT (6667) // leave it like this < its used by most or i'd say all networks
  41. #define IRC_CHANNEL "#MyEchoChannel" //Echo channel for normal users
  42. #define IRC_ADMINCHANNEL "#MyStaffChannel" //Staff channel
  43. #define MAX_BOTS (4) // number of bots you're using
  44. new gBotID[MAX_BOTS],gGroupID, PlayersOnline = 0;
  45. //----------------------------------------------------------------
  46. //----------------IRC CallBacks --------------------------------------
  47. public IRC_OnConnect(botid)
  48. {
  49. new string[156];
  50. printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
  51. // Join the channel
  52. if(botid == 1 || botid == 2 || botid == 3)
  53. {
  54. //Here the bots send message to network to identify (login)
  55. IRC_JoinChannel(botid, IRC_CHANNEL);
  56. format(string,sizeof(string),"PRIVMSG NickServ :identify %s",IRC_BOT_PASSWORD);
  57. IRC_SendRaw(botid, string);
  58. IRC_AddToGroup(gGroupID, botid);
  59. }
  60. if(botid == 1 || botid == 2 || botid == 3)
  61. {
  62. //Here the bots send message to network to identify (login)
  63. format(string,sizeof(string),"PRIVMSG NickServ :identify %s",IRC_BOT_PASSWORD);
  64. IRC_SendRaw(botid, string);
  65. format(string,sizeof(string),"JOIN %s :%s",IRC_ADMINCHANNEL,IRC_ADMINCHANNEL_PASSWORD);
  66. IRC_SendRaw(botid, string);
  67. format(string,sizeof(string),"MSG %s :Hello Guise",IRC_ADMINCHANNEL);
  68. IRC_SendRaw(botid, string);
  69. format(string,sizeof(string),"MSG %s :Hello Guise",IRC_CHANNEL);
  70. IRC_SendRaw(botid, string);
  71. IRC_AddToGroup(gGroupID, botid);
  72. }
  73. // Add the bot to the group
  74. return 1;
  75. }
  76.  
  77. public IRC_OnDisconnect(botid)
  78. {
  79. //Usually you wont see this... i've added a script which changes bot name in case there's already someone using your bots name
  80. //Instead of not connecting at all, it simply changes name
  81. printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
  82. if (botid == gBotID[0])
  83. {
  84. // Reset the bot ID
  85. IRC_ChangeNick(botid, "TestBot");
  86. gBotID[0] = 0;
  87. // Wait 20 seconds for the first bot
  88. SetTimerEx("IRC_ConnectDelay", 20000, 0, "d", 1);
  89. }
  90. else if (botid == gBotID[1])
  91. {
  92. // Reset the bot ID
  93. IRC_ChangeNick(botid, "TestBot1");
  94. gBotID[1] = 0;
  95. // Wait 25 seconds for the second bot
  96. SetTimerEx("IRC_ConnectDelay", 25000, 0, "d", 2);
  97. }
  98.  
  99. else if (botid == gBotID[2])
  100. {
  101. // Reset the bot ID
  102. IRC_ChangeNick(botid, "TestBot2");
  103. gBotID[2] = 0;
  104. // Wait 30 seconds for the third bot
  105. SetTimerEx("IRC_ConnectDelay", 30000, 0, "d", 3);
  106. }
  107. printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
  108. printf("*** Changing bot name...");
  109. // Remove the bot from the group
  110. IRC_RemoveFromGroup(gGroupID, botid);
  111. return 1;
  112. }
  113. public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
  114. {
  115. //Whenever a user joins the channel (staff or echo) bot sends him/her welcome message
  116. //We're using IRC_Notice instead of IRC_Say so that only the user who joined see's the msg
  117. IRC_Notice(botid, user, "Welcome to DayZ-IRC, check !cmds to get started!");
  118. return 1;
  119. }
  120. //--------------------------------------------------------------------------------------------------------------
  121.  
  122.  
  123.  
  124. //-------------------------------------------SAMP CALLBACKS------------------------------------------------------
  125. public OnFilterScriptInit()
  126. {
  127. irc_connectoninit();
  128. PlayersOnline = 0;
  129. return 1;
  130. }
  131. public OnFilterScriptExit()
  132. {
  133. IRC_Quit(gBotID[0], "Cya faggots");
  134. IRC_Quit(gBotID[1], "Cya faggots");
  135. IRC_Quit(gBotID[2], "Cya faggots");
  136. IRC_DestroyGroup(gGroupID);
  137. return 1;
  138. }
  139. public OnPlayerConnect(playerid)
  140. {
  141. new string1[128], PlrIP[16], pname[24];
  142. GetPlayerName(playerid, pname, sizeof(pname)); // get player name
  143. GetPlayerIp(playerid, PlrIP, sizeof(PlrIP)); // get player ip
  144. //Anticheat! disallow website names & ips in name!
  145. if(FindIP(pname))
  146. {
  147. Kick(playerid);
  148. return 1;
  149. }
  150. 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)
  151. {
  152. KickWithMessage(playerid, "A username that contains www. or .com are not allowed on this server.");
  153. return 1;
  154. }
  155.  
  156. // now about message
  157. PlayersOnline++;
  158. format(string1, sizeof(string1), "10[JOIN] %s[%d] has joined the server.4[%d]", pname,playerid,PlayersOnline);
  159. IRC_GroupSay(gGroupID, IRC_CHANNEL, string1);
  160. //Send message to admin channel with player ip!
  161. format(string1, sizeof(string1), "10[JOIN] %s[%d] has joined the server - (IP): %s", pname, playerid, PlrIP);
  162. IRC_GroupSay(gGroupID, IRC_ADMINCHANNEL, string1);
  163. return 1;
  164. }
  165.  
  166. public OnPlayerDisconnect(playerid, reason)
  167. {
  168. PlayersOnline--;
  169. new leaveMsg[128], name[MAX_PLAYER_NAME], reasonMsg[20];
  170. switch(reason)
  171. {
  172. case 0: reasonMsg = "Timeout/Crash";
  173. case 1: reasonMsg = "Leaving";
  174. case 2: reasonMsg = "Kicked/Banned";
  175. }
  176. //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);"
  177. //before return 1;
  178. GetPlayerName(playerid, name, sizeof(name));
  179. format(leaveMsg, sizeof(leaveMsg), "14[PART]%s (%d) Has Left The Server -(%s)[%i]", name, playerid, reasonMsg, PlayersOnline);
  180. IRC_GroupSay(gGroupID, IRC_CHANNEL, leaveMsg);
  181. return 1;
  182. }
  183.  
  184. public OnPlayerDeath(playerid, killerid, reason)
  185. {
  186. if (killerid != INVALID_PLAYER_ID) // we're checking that the killer is a calid player
  187. {
  188. new pname[24],
  189. killername[24],
  190. string[128];
  191.  
  192. GetPlayerName(playerid,pname,sizeof(pname));
  193. GetPlayerName(killerid,killername,sizeof(killername));
  194. format(string,sizeof(string),"5[KILL] %s(%d) has been killed by %s(%d) - %s",pname,playerid,killername,killerid, GetDeathReason(reason));
  195. IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
  196. }
  197.  
  198. return 1;
  199. }
  200. public OnPlayerText(playerid, text[])
  201. {
  202. //We'll a code here which prevents people from use caps in game, you can remove it if you wish...
  203. new i;
  204. while (text[++i])
  205. {
  206. if ('A' <= text[i] <= 'Z') text[i] |= 0x20;
  207. }
  208. //now about text
  209. new wantedlevel;
  210. wantedlevel = GetPlayerWantedLevel(playerid);
  211. if(wantedlevel == 0)
  212. {
  213. new string[128], pname[24];
  214. GetPlayerName(playerid, pname, sizeof(pname));
  215. format(string, sizeof(string), "12[%d] 6%s7[INNOCENT]: 5 %s",playerid, pname, text);
  216. IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
  217. }
  218. else if(wantedlevel > 0)
  219. {
  220. new string[128], pname[24];
  221. GetPlayerName(playerid, pname, sizeof(pname));
  222. format(string, sizeof(string), "12[%d] 6%s7[WANTED]: 5 %s",playerid, pname, text);
  223. IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
  224. }
  225. return 1;
  226. }
  227.  
  228. //----------------------------------------------IRC COMMANDS-------------------------------------------------
  229. /*You can change permissions to your likes for commands, here's a small explaination of permissions:
  230.  
  231. -IRC_IsOwner (only the user having owner on irc channel can use cmd)
  232. -IRC_IsAdmin (only the user having admin on irc channel can use cmd)
  233. -IRC_IsOp (only the user having op on irc channel can use cmd)
  234. -IRC_IsHalfop(only the user having half-op on irc channel can use cmd)
  235. -IRC_IsVoice (only the user having voice on irc channel can use cmd)
  236. */
  237. IRCCMD:cmds(botid, channel[], user[], host[], params[])
  238. {
  239. if(IRC_IsOwner(botid, channel, user))
  240. {
  241. IRC_Say(botid, IRC_CHANNEL,"4IRC Commands(at owner level)");
  242. IRC_Say(botid, IRC_CHANNEL,"12!rcon !say !clearchat !pm !players !warn !giveallcash !admin !spawn !caps !info");
  243. IRC_Say(botid, IRC_CHANNEL,"12!bjoin !kick !weaps !unban !aall !slap !setcash !setscore !spam !setwanted !contime");
  244. IRC_Say(botid, IRC_CHANNEL,"12!ban !resapwnalluv !adan !adkill respawnallv !hall !giveallweapon !getid !exit !ppl");
  245. IRC_Say(botid, IRC_CHANNEL,"12!setname !veh !disarm !showip ");
  246. }
  247. return 1;
  248. }
  249. IRCCMD:spam(botid, channel[], user[], host[], params[])
  250. {
  251. // Check if the user entered any text
  252. // Echo the formatted message
  253. if (IRC_IsHalfop(botid, channel, user))
  254. {
  255. new msg[112];
  256. format(msg,sizeof(msg), "[BOT] Please do not Flood or Spam in chat, or else you will be muted!", user, params);
  257. SendClientMessageToAll(COLOR_RED, msg);
  258. format(msg, sizeof(msg),"2[PBOT] Please do not Flood or Spam in chat, or else you will be muted!", user, params);
  259. IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
  260. return 1;
  261. }
  262. return 1;
  263. }
  264.  
  265. IRCCMD:caps(botid, channel[], user[], host[], params[])
  266. {
  267. // Check if the user entered any text
  268. // Echo the formatted message
  269. if (IRC_IsHalfop(botid, channel, user))
  270. {
  271. new msg[112];
  272. format(msg,sizeof(msg), "[BOT] Please turn off your caps, or else you will be muted!", user, params);
  273. SendClientMessageToAll(COLOR_RED, msg);
  274. format(msg, sizeof(msg),"2[PBOT] Please turn off your caps, or else you will be muted!", user, params);
  275. IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
  276. return 1;
  277. }
  278. return 1;
  279. }
  280. IRCCMD:rcon(botid, channel[], user[], host[], params[])
  281. {
  282. // Check if the user is at least an op in the channel
  283. if (IRC_IsOwner(botid, channel, user))
  284. {
  285. // Check if the user entered any text
  286. if (!isnull(params))
  287. {
  288. // Check if the user did not enter any invalid commands
  289. if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
  290. {
  291. // Echo the formatted message
  292. new msg[128];
  293. format(msg, sizeof(msg), "RCON command %s has been executed.", params);
  294. IRC_GroupSay(gGroupID, channel, msg);
  295. // Send the command
  296. SendRconCommand(params);
  297. }
  298. }
  299. }
  300. return 1;
  301. }
  302. // restart server
  303. IRCCMD:exit(botid, channel[], user[], host[], params[])
  304. {
  305. new string[24];
  306. // Check if the user is at least an op in the channel
  307. if (IRC_IsOwner(botid, channel, user))
  308. {
  309. format(string, sizeof(string), "EXIT CMD BY %s",user);
  310. IRC_Quit(gBotID[0], string);
  311. IRC_Quit(gBotID[1], string);
  312. IRC_Quit(gBotID[2], string);
  313. IRC_DestroyGroup(gGroupID);
  314. SendRconCommand("gmx");
  315. IRC_Say(botid, IRC_CHANNEL, "EXIT");
  316. }
  317. return 1;
  318. }
  319. // check player packetloss
  320. IRCCMD:ppl(botid, channel[], user[], host[], params[])
  321. {
  322. new string[128], otherID, othername[24];
  323. if(IRC_IsHalfop(botid, channel, user))
  324. {
  325. if(sscanf(params, "d", otherID))
  326. {
  327. return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!ppl <player / ID>\"");
  328. }
  329. else
  330. {
  331. GetPlayerName(otherID, othername, sizeof(othername));
  332. format(string,sizeof(string),"8[PACKETLOSS] Player %s's packets loss: %.2f percent.",othername,NetStats_PacketLossPercent(otherID));
  333. IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
  334. }
  335. }
  336. else
  337. {
  338. return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10You must be halfop to use this command.");
  339. }
  340. return 1;
  341. }
  342. //Check for how many mins has the player been connected to server.
  343. IRCCMD:contime(botid, channel[], user[], host[], params[])
  344. {
  345. new string[128], otherID, othername[24];
  346.  
  347.  
  348. if(IRC_IsHalfop(botid, channel, user))
  349. {
  350. if(sscanf(params, "d", otherID))
  351. {
  352. return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!contime <player / ID>\"");
  353. }
  354. else
  355. {
  356. new seconds = NetStats_GetConnectedTime(otherID) / 1000;
  357. new minutes = seconds / 60;
  358. GetPlayerName(otherID, othername, sizeof(othername));
  359. format(string,sizeof(string),"3[Connted Time] Player %s has been connected for: %i minutes.",othername,minutes);
  360. IRC_GroupSay(gGroupID,IRC_CHANNEL,string);
  361. }
  362. }
  363. else
  364. {
  365. return IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10You must be halfop to use this command.");
  366. }
  367. return 1;
  368. }
  369.  
  370. //This command comes with level by chat in game & with a anti advertisement via irc!
  371. IRCCMD:say(botid, channel[], user[], host[], params[])
  372. {
  373. if (!isnull(params))
  374. {
  375.  
  376.  
  377. if(IRC_IsOwner(botid, channel, user))
  378. {
  379. // Echo the formatted message
  380. new msg[112];
  381. format(msg,sizeof(msg), "(IRC-Owner)%s: %s", user, params);
  382. SendClientMessageToAll(COLOR_GREEN, msg);
  383. format(msg, sizeof(msg),"4(IRC-Owner) %s:1%s", user, params);
  384. IRC_GroupSay(gGroupID, channel, msg);
  385.  
  386. }
  387. else if(IRC_IsAdmin(botid, channel, user))
  388. {
  389. // Echo the formatted message
  390. new msg[112];
  391. format(msg,sizeof(msg), "(IRC-High_Admin)%s: %s", user, params);
  392. SendClientMessageToAll(COLOR_GREEN, msg);
  393. format(msg, sizeof(msg),"4(IRC-High_Admin) %s:1%s", user, params);
  394. IRC_GroupSay(gGroupID, channel, msg);
  395.  
  396. }
  397.  
  398. else if(IRC_IsOp(botid, channel, user))
  399. {
  400.  
  401. 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)
  402. {
  403. IRC_GroupSay(gGroupID, IRC_CHANNEL, "4[SPAM] Advert detected! If this occurs frequently, you will be kicked.");
  404. return 0;
  405. }
  406.  
  407. // Echo the formatted message
  408. new msg[112];
  409. format(msg,sizeof(msg), "(IRC-Admin)%s: %s", user, params);
  410. SendClientMessageToAll(COLOR_GREEN, msg);
  411. format(msg, sizeof(msg),"4(IRC-Admin) %s:1%s", user, params);
  412. IRC_GroupSay(gGroupID, channel, msg);
  413.  
  414. }
  415. else if(IRC_IsHalfop(botid, channel, user))
  416. {
  417.  
  418. 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)
  419. {
  420. IRC_GroupSay(gGroupID, IRC_CHANNEL, "4[SPAM] Advert detected! If this occurs frequently, you will be kicked.");
  421. return 0;
  422. }
  423.  
  424.  
  425. // Echo the formatted message
  426. new msg[112];
  427. format(msg,sizeof(msg), "(IRC-Mod)%s: %s", user, params);
  428. SendClientMessageToAll(COLOR_GREEN, msg);
  429. format(msg, sizeof(msg),"12(IRC-Mod) %s:1%s", user, params);
  430. IRC_GroupSay(gGroupID, channel, msg);
  431.  
  432. }
  433. else
  434. {
  435. 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)
  436. {
  437. IRC_GroupSay(gGroupID, IRC_CHANNEL, "4[SPAM] Advert detected! If this occurs frequently, you will be kicked.");
  438. return 0;
  439. }
  440.  
  441. // Echo the formatted message
  442. new msg[112];
  443. format(msg,sizeof(msg), "(IRC)%s: %s", user, params);
  444. SendClientMessageToAll(COLOR_GREEN, msg);
  445. format(msg, sizeof(msg),"4(IRC)%s:1%s", user, params);
  446. IRC_GroupSay(gGroupID, channel, msg);
  447.  
  448. }
  449. }
  450. return 1;
  451. }
  452. // talk as admin
  453. IRCCMD:admin(botid, channel[], user[], host[], params[])
  454. {
  455. if (IRC_IsHalfop(botid, channel, user))
  456. {
  457. if (!isnull(params))
  458. {
  459. new msg[112];
  460. format(msg,sizeof(msg), "Admin on IRC: %s", params);
  461. SendClientMessageToAll(COLOR_GREEN, msg);
  462. format(msg,sizeof(msg), "Admin on IRC: %s", params);
  463. IRC_GroupSay(gGroupID, channel, msg);
  464. }
  465. }
  466. return 1;
  467. }
  468. IRCCMD:players(botid, channel[], user[], host[], params[]) // not taking from anyone, selfmade, remember PlayerOnline ?
  469. {
  470. new string[80];
  471. format(string, sizeof(string), "Players Online: %i",PlayersOnline);
  472. IRC_GroupSay(gGroupID, channel, string);
  473. return 1;
  474. }
  475. IRCCMD:pm(botid, channel[], user[], host[], params[]) {
  476. new str[128], str2[128], id, pname[24];
  477. if(sscanf(params,"ds[128]", id, str2)) return IRC_GroupSay(gGroupID, IRC_CHANNEL,"10Usage:!pm [id] [message]");
  478. if(IsPlayerConnected(id))
  479. {
  480. GetPlayerName(id, pname, sizeof(pname));
  481. format(str, sizeof(str),"12PM to [%d]%s: %s", id, pname, str2);
  482. IRC_GroupSay(gGroupID, channel, str);
  483. format(str, sizeof(str),"[IRC PM]%s: %s", user, str2);
  484. SendClientMessage(id, COLOR_GREEN, str);
  485.  
  486.  
  487. }else return IRC_GroupSay(gGroupID, IRC_CHANNEL,"11,10Player is not connected Right Now");
  488. return 1;
  489. }
  490. IRCCMD:adan(botid, channel[], user[], host[], params[])
  491. {
  492. if (IRC_IsOp(botid, channel, user))
  493. {
  494. if (!isnull(params))
  495. {
  496. new msg[112];
  497. format(msg,sizeof(msg), "%s", params);
  498. GameTextForAll(msg, 7000, 3);
  499. format(msg,sizeof(msg), "12[ANNOUNCEMENT by %s] %s", user, params);
  500. IRC_GroupSay(gGroupID, channel, msg);
  501. }
  502. }
  503. return 1;
  504. }
  505. IRCCMD:clearchat(botid, channel[], user[], host[], params[])
  506. {
  507.  
  508. if(IRC_IsHalfop(botid, channel, user))
  509. {
  510. for(new i = 0; i < 50; i++)
  511. {
  512. SendClientMessageToAll(COLOR_WHITE," ");
  513. }
  514.  
  515. SendClientMessageToAll(COLOR_WHITE, "{A9C4E4}An administrator has cleared the chat.");
  516. }
  517. else
  518. {
  519. return 0;
  520. }
  521. return 1;
  522. }
  523. IRCCMD:giveallcash(botid, channel[], user[], host[], params[])
  524. {
  525. if(IRC_IsAdmin(botid, channel, user))
  526. {
  527. new amount, message[128];
  528. if(sscanf(params, "i", amount))
  529. {
  530. IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!giveallcash <amount>\"");
  531. }
  532. else
  533. {
  534. if (amount > 0)
  535. {
  536. foreach(Player, i)
  537. {
  538.  
  539. GivePlayerMoney(i, amount);
  540.  
  541. }
  542.  
  543. format(message, sizeof(message), "{A9C4E4}All players have been given {FFFFFF}$%s by %s", FormatNumber(amount), user);
  544. SendClientMessageToAll(COLOR_WHITE, message);
  545. }
  546. else
  547. {
  548. IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] The amount must be greater than 0.");
  549. }
  550. }
  551. }
  552. else
  553. {
  554. return 0;
  555. }
  556. return 1;
  557. }
  558. IRCCMD:giveallweapon(botid, channel[], user[], host[], params[])
  559. {
  560. if(IRC_IsAdmin(botid, channel, user))
  561. {
  562. new weapID, weapAmmo, message[128];
  563.  
  564. if(sscanf(params, "ii", weapID, weapAmmo))
  565. {
  566. IRC_GroupSay(gGroupID,IRC_CHANNEL, "11,10Usage: \"!giveallweapon <weaponID> <weaponAmmo>\"");
  567. }
  568. else
  569. {
  570. if(weapID < 1 || weapID > 46)
  571. {
  572. return IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] {FFFFFF}Weapon ID should be between 1 and 46.");
  573. }
  574. else
  575. {
  576. if(weapAmmo < 1 || weapAmmo > 600)
  577. {
  578. return IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] {FFFFFF}Weapon ammo should be between 1 and 600.");
  579. }
  580. else
  581. {
  582. switch(weapID)
  583. {
  584. case 16, 35, 36, 37, 38, 39, 40, 43, 44, 45:
  585. {
  586. return IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] {FFFFFF}You cannot give this weapon to all players.");
  587. }
  588. }
  589.  
  590. foreach(Player, i)
  591. {
  592.  
  593. GivePlayerWeapon(i, weapID, weapAmmo);
  594.  
  595. }
  596.  
  597. format(message, sizeof(message), "{A9C4E4}An administrator has given everyone a %W with %i ammo.", weapID, weapAmmo);
  598. SendClientMessageToAll(COLOR_WHITE, message);
  599. IRC_GroupSay(gGroupID, channel, message);
  600. }
  601. }
  602. }
  603. }
  604. else
  605. {
  606. return 0;
  607. }
  608.  
  609.  
  610. return 1;
  611. }
  612. IRCCMD:getid(botid, channel[], user[], host[], params[])
  613. {
  614.  
  615. new namepart[24];
  616. if(sscanf(params, "s[24]", namepart))
  617. return IRC_GroupSay(gGroupID,IRC_CHANNEL, "11,10Usage: /getid <part of nickname>");
  618. new found, string[128], playername[MAX_PLAYER_NAME];
  619. format(string,sizeof(string),"12Searching for: %s", namepart);
  620. IRC_Say(botid, IRC_CHANNEL,string);
  621. foreach(Player, i)
  622. {
  623. GetPlayerName(i, playername, MAX_PLAYER_NAME);
  624. new namelen = strlen(playername);
  625. new bool:searched=false;
  626. for(new pos=0; pos <= namelen; pos++)
  627. {
  628. if(searched != true)
  629. {
  630. if(strfind(playername,namepart,true) == pos)
  631. {
  632. found++;
  633. format(string,sizeof(string),"12%d. %s (ID %d)", found, playername, i);
  634. IRC_Say(botid, IRC_CHANNEL, string);
  635. searched = true;
  636. }
  637. }
  638. }
  639. }
  640. if(found == 0) return IRC_Say(botid, IRC_CHANNEL, "4No players have this in their nickname");
  641. return 1;
  642. }
  643. IRCCMD:adkill(botid, channel[], user[], host[], params[])
  644. {
  645.  
  646. if(IRC_IsOp(botid, channel, user))
  647. {
  648. new otherID, otherName[24];
  649.  
  650. if(sscanf(params, "d", otherID))
  651. {
  652. IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage: \"!adkill <playername/id>\"");
  653. }
  654. else
  655. {
  656. if(IsPlayerConnected(otherID))
  657. {
  658.  
  659. GetPlayerName(otherID, otherName, sizeof(otherName));
  660.  
  661. new message[128];
  662. format(message, sizeof(message), "[ADMIN] You have slain %s(%i)!", otherName, otherID);
  663. IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
  664.  
  665. SendClientMessage(otherID, COLOR_WHITE, "{A9C4E4}An administrator has killed you.");
  666. SetPlayerHealth(otherID, 0);
  667.  
  668. }
  669. else
  670. {
  671. IRC_GroupSay(gGroupID,IRC_CHANNEL, "4,10[SERVER] That player is not online!");
  672. }
  673. }
  674. }
  675. else
  676. {
  677. return 0;
  678. }
  679. return 1;
  680. }
  681. IRCCMD:setscore(botid, channel[], user[], host[], params[])
  682. {
  683. new score, otherName[24], target, message[128];
  684. if(IRC_IsAdmin(botid, channel, user))
  685. {
  686. if(sscanf(params, "iu",target,score))
  687. {
  688. IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <score>");
  689. }
  690. else
  691. {
  692. GetPlayerName(target, otherName, sizeof(otherName));
  693. SetPlayerScore(target, score);
  694. format(message, sizeof(message), "11,10[ADMIN] You set %s's score to %i", otherName, score);
  695. IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
  696. format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your score has been set to {FFDC2E}%i", score);
  697. SendClientMessage(target, COLOR_WHITE, message);
  698. }
  699. }
  700. else
  701. {
  702. IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
  703. }
  704. return 1;
  705. }
  706. IRCCMD:setcash(botid, channel[], user[], host[], params[])
  707. {
  708. new cash, otherName[24], target, message[128];
  709. if(IRC_IsAdmin(botid, channel, user))
  710. {
  711. if(sscanf(params, "iu",target,cash))
  712. {
  713. IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <cash>");
  714. }
  715. else
  716. {
  717. GetPlayerName(target, otherName, sizeof(otherName));
  718. GivePlayerMoney(target, cash);
  719. format(message, sizeof(message), "11,10[ADMIN] You set %s's cash to %i", otherName, cash);
  720. IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
  721. format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your cash has been set to {FFDC2E}%i", cash);
  722. SendClientMessage(target, COLOR_WHITE, message);
  723. }
  724. }
  725. else
  726. {
  727. IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
  728. }
  729. return 1;
  730. }
  731.  
  732. IRCCMD:setwanted(botid, channel[], user[], host[], params[])
  733. {
  734. new wanted, otherName[24], target, message[128];
  735. if(IRC_IsAdmin(botid, channel, user))
  736. {
  737. if(sscanf(params, "iu",target,wanted))
  738. {
  739. IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <wanted>");
  740. }
  741. else
  742. {
  743. GetPlayerName(target, otherName, sizeof(otherName));
  744. SetPlayerWantedLevel(target, wanted);
  745. format(message, sizeof(message), "11,10[ADMIN] You set %s's wanted to %i", otherName, wanted);
  746. IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
  747. format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your wanted has been set to {FFDC2E}%i", wanted);
  748. SendClientMessage(target, COLOR_WHITE, message);
  749. }
  750. }
  751. else
  752. {
  753. IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
  754. }
  755. return 1;
  756. }
  757. IRCCMD:setname(botid, channel[], user[], host[], params[])
  758. {
  759. new name[24], otherName[24], target, message[128];
  760. if(IRC_IsAdmin(botid, channel, user))
  761. {
  762. if(sscanf(params, "is[24]",target,name))
  763. {
  764. IRC_GroupSay(gGroupID,IRC_CHANNEL,"11,10Usage:set <player / ID> <name>");
  765. }
  766. else
  767. {
  768. GetPlayerName(target, otherName, sizeof(otherName));
  769. SetPlayerName(target, name);
  770. format(message, sizeof(message), "11,10[ADMIN] You set %s's name to %s", otherName, name);
  771. IRC_GroupSay(gGroupID,IRC_CHANNEL, message);
  772. format(message, sizeof(message), "{B7B7B7}[INFO] {FFFFFF}Your name has been set to {FFDC2E}%s", name);
  773. SendClientMessage(target, COLOR_WHITE, message);
  774. }
  775. }
  776. else
  777. {
  778. IRC_GroupSay(gGroupID,IRC_CHANNEL, "You are not authorized to use this command!");
  779. }
  780. return 1;
  781. }
  782.  
  783. IRCCMD:veh(botid, channel[], user[], host[], params[])
  784. {
  785. new target, targetname[24], car;
  786. if(IRC_IsOp(botid, channel, user))
  787. {
  788.  
  789. new Float:X, Float:Y, Float:Z, Vehicle;
  790. if(sscanf(params,"ui", target,car)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !Veh <userid/name> <Vehicle ID 400 - 611>");
  791. if(car < 400 || car > 611) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "ERROR: Cannot go under 400 or above 611.");
  792. if(car == 520 && strcmp(user, "YourName",true) != 0 || car == 425 && strcmp(user, "Someone Else's name",true) != 0)
  793. {
  794. return IRC_GroupSay(gGroupID,IRC_CHANNEL, "This vehicle is reserved for the boss");
  795. }
  796. GetPlayerName(target, targetname, sizeof(targetname));
  797. GetPlayerPos(target, X, Y, Z);
  798. Vehicle = CreateVehicle(car, X, Y, Z + 2.0, 0, 0, 0, -1);
  799. PutPlayerInVehicle(target, Vehicle, 0);
  800. IRC_GroupSay(gGroupID, channel, "Vehicle has been given succesfully!");
  801. }
  802. return 1;
  803. }
  804.  
  805. IRCCMD:disarm(botid, channel[], user[], host[], params[])
  806. {
  807. new target;
  808. if(IRC_IsOp(botid, channel, user))
  809. {
  810. if(sscanf(params,"i", target)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !disarm <userid/name>");
  811. ResetPlayerWeapons(target);
  812. IRC_GroupSay(gGroupID, channel, "You have succesfully removed player's weapons!");
  813. }
  814. return 1;
  815. }
  816. IRCCMD:showip(botid, channel[], user[], host[], params[])
  817. {
  818. new target, plrIP[16], string[128];
  819. if(IRC_IsHalfop(botid, channel, user))
  820. {
  821. if(sscanf(params,"i", target)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !showip <userid/name>");
  822. GetPlayerIp(target, plrIP, sizeof(plrIP));
  823. format(string, sizeof(string), "[IP REQUESTED BY %s]Player's IP: %s",user,plrIP);
  824. IRC_GroupSay(gGroupID, channel, string);
  825. }
  826. return 1;
  827. }
  828. IRCCMD:warn(botid, channel[], user[], host[], params[]) {
  829. if (IRC_IsHalfop(botid, channel, user))
  830. {
  831. new endid, reason[24], pname[24];
  832. if(sscanf(params,"is[24]", endid, reason))return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10JikyBot: 11,10Usage:!warn [playerid] [reason]");
  833. new str[128];
  834. if(IsPlayerConnected(endid) && endid != INVALID_PLAYER_ID)
  835. {
  836. if (IRC_IsHalfop(botid, channel, user))
  837. {
  838. GetPlayerName(endid, pname, 24);
  839. format(str, sizeof (str), "*Administrator \"%s\" has warned \"%s\". (Warning: %d/%d)***", user, pname);
  840. SendClientMessageToAll(COLOR_RED, str);
  841. format(str, sizeof (str), "[Reason: %s]", reason);
  842. SendClientMessageToAll(COLOR_RED, str);
  843. format(str, sizeof (str), "*11,10Administrator \"%s\" has warned \"%s\". ***", user, pname);
  844. IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
  845. format(str, sizeof (str), "11,10[Reason: %s]", reason);
  846. IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
  847. format(str, 9909, "{FF7E19}Name: %s\n{00F700}Admin: %s\n{E10000}Reason: %s\n",pname,user,reason);
  848. ShowPlayerDialog(endid, 9909, DIALOG_STYLE_MSGBOX, "{00F700}Warned", str, "Close", "");
  849.  
  850. }
  851.  
  852. return 1;
  853. } else return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10JikyBot: Player is not connected");
  854. } else return IRC_GroupSay(gGroupID, IRC_CHANNEL,"11,10[LEVEL-INFO]:Invalid command! use /commands or /cmds to check full list.");
  855. }
  856.  
  857.  
  858. IRCCMD:weaps(botid, channel[], user[], host[], params[]) {
  859. if (IRC_IsHalfop(botid, channel, user))
  860. {
  861. if(isnull(params)) return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11 Usage:/weaps [playerid]");
  862. new player1, string[128], string2[64], WeapName[24], slot, weap, ammo, wh, x, pname[24];
  863. player1 = strval(params);
  864. GetPlayerName(player1, pname, 24);
  865. if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
  866. format(string2,sizeof(string2),"11,10[>> %s Weapons (id:%d) <<]", pname, player1); IRC_GroupSay(gGroupID, IRC_CHANNEL, string2);
  867. for (slot = 0; slot < 14; slot++) { GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) wh++; }
  868. if(wh < 1) return IRC_GroupSay(gGroupID, IRC_CHANNEL,"Player has no weapons");
  869.  
  870. if(wh >= 1)
  871. {
  872. for (slot = 0; slot < 14; slot++)
  873. {
  874. GetPlayerWeaponData(player1, slot, weap, ammo);
  875. if( ammo != 0 && weap != 0)
  876. {
  877. GetWeaponName(weap, WeapName, sizeof(WeapName) );
  878. if(ammo == 65535 || ammo == 1) format(string,sizeof(string),"%s%s (1)",string, WeapName );
  879. else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo );
  880. x++;
  881. if(x >= 5)
  882. {
  883. IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
  884. x = 0;
  885. format(string, sizeof(string), "");
  886. }
  887. else format(string, sizeof(string), "%s, ", string);
  888. }
  889. }
  890. if(x <= 4 && x > 0) {
  891. string[strlen(string)-3] = '.';
  892. IRC_GroupSay(gGroupID, IRC_CHANNEL, string);
  893. }
  894. }
  895. return 1;
  896. } else return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10Player is not connected");
  897. } else return IRC_GroupSay(gGroupID, IRC_CHANNEL, "11,10[LEVEL-INFO]:Invalid command! use /commands or /cmds to check full list.");
  898. }
  899.  
  900. IRCCMD:kick(botid, channel[], user[], host[], params[])
  901. {
  902. new target, reason[30], str[128], pname[24];
  903. if(IRC_IsOp(botid, channel, user))
  904. {
  905. if(sscanf(params,"is[30]", target,reason)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !kick <userid/name> <reason>");
  906. GetPlayerName(target, pname, 24);
  907. format(str, sizeof(str), "IRC Admin %s has kicked %s(%i) from the server[REASON: %s]",user, pname, target, reason);
  908. SendClientMessageToAll(COLOR_RED, str);
  909. IRC_GroupSay(gGroupID, channel, str);
  910. Kick(target);
  911. }
  912. return 1;
  913. }
  914. IRCCMD:ban(botid, channel[], user[], host[], params[])
  915. {
  916. new target, reason[30], str[128], pname[24];
  917. if(IRC_IsOp(botid, channel, user))
  918. {
  919. if(sscanf(params,"is[30]", target,reason)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !ban <userid/name> <reason>");
  920. GetPlayerName(target, pname, 24);
  921. format(str, sizeof(str), "IRC Admin %s has banned %s(%i) from the server[REASON: %s]",user, pname, target, reason);
  922. SendClientMessageToAll(COLOR_RED, str);
  923. IRC_GroupSay(gGroupID, channel, str);
  924. Ban(target);
  925. }
  926. return 1;
  927. }
  928. IRCCMD:hall(botid, channel[], user[], host[], params[])
  929. {
  930. if(IRC_IsHalfop(botid, channel, user))
  931. {
  932. foreach(Player, i)
  933. {
  934. if(IsPlayerConnected(i))
  935. {
  936. SetPlayerHealth(i, 100);
  937. }
  938. }
  939. }
  940. return 1;
  941. }
  942. IRCCMD:aall(botid, channel[], user[], host[], params[])
  943. {
  944. if(IRC_IsHalfop(botid, channel, user))
  945. {
  946. foreach(Player, i)
  947. {
  948. if(IsPlayerConnected(i))
  949. {
  950. SetPlayerArmour(i, 100);
  951. }
  952. }
  953. }
  954. return 1;
  955. }
  956.  
  957. IRCCMD:resawpnallv(botid, channel[], user[], host[], params[])
  958. {
  959.  
  960. if(IRC_IsOp(botid, channel, user))
  961. {
  962.  
  963. for(new i = 0; i < MAX_VEHICLES; i++)
  964. {
  965. if(IsValidVehicle(i))
  966. {
  967. SetVehicleToRespawn(i);
  968. }
  969. }
  970. SendClientMessageToAll(COLOR_WHITE, "{A9C4E4}An administrator has respawned server vehicles.");
  971. IRC_GroupSay(gGroupID, channel, "An IRC administrator has respawned server vehicles.");
  972. }
  973. return 1;
  974. }
  975. IRCCMD:resawpnalluv(botid, channel[], user[], host[], params[])
  976. {
  977. if(IRC_IsOp(botid, channel, user))
  978. {
  979.  
  980. for(new i = 0; i < MAX_VEHICLES; i++)
  981. {
  982. if(!IsVehicleOccupied(i))
  983. {
  984. SetVehicleToRespawn(i);
  985. }
  986. }
  987. SendClientMessageToAll(COLOR_WHITE, "{A9C4E4}An administrator has respawned server unused vehicles.");
  988. IRC_GroupSay(gGroupID, channel, "An IRC administrator has respawned server unused vehicles.");
  989. }
  990. return 1;
  991. }
  992. IRCCMD:explode(botid, channel[], user[], host[], params[])
  993. {
  994. new target;
  995. if(IRC_IsOp(botid, channel, user))
  996. {
  997. if(sscanf(params,"i", target)) return IRC_GroupSay(gGroupID,IRC_CHANNEL, "USAGE: !explode <userid/name>");
  998. new Float:dX, Float:dY, Float:dZ;
  999. GetPlayerPos(target, dX, dY, dZ);
  1000. CreateExplosion(dX, dY, dZ, 12, 1.0);
  1001. new otherName[24];
  1002. GetPlayerName(target, otherName, sizeof(otherName));
  1003. new log[250];
  1004. format(log, sizeof(log), "%s(%i) has exploded %s(%i)", user, otherName, target);
  1005. IRC_GroupSay(gGroupID, channel, log);
  1006.  
  1007. }
  1008. return 1;
  1009. }
  1010. IRCCMD:info(botid, channel[], user[], host[], params[])
  1011. {
  1012. // Check if the user is at least an op in the channel
  1013. new strmessage[950], hostname[40], port;
  1014. GetServerVarAsString("hostname", hostname, sizeof(hostname));
  1015. port = GetServerVarAsInt("port");
  1016. format(strmessage, sizeof(strmessage), "6[Server INFO]");
  1017. IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
  1018. format(strmessage, sizeof(strmessage), "6[Server Ip]Your_Server_IP:%d",port);
  1019. IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
  1020. format(strmessage, sizeof(strmessage), "6[HOSTNAME] %s",hostname);
  1021. IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
  1022. format(strmessage, sizeof(strmessage), "6[Version]: YOUR_VERSION");
  1023. IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
  1024. format(strmessage, sizeof(strmessage), "6[Website]: YOUR_WEBSITE");
  1025. IRC_GroupSay(gGroupID, IRC_CHANNEL, strmessage);
  1026. return true;
  1027. }
  1028.  
  1029.  
  1030.  
  1031.  
  1032. //--------------------------------IN GAME COMMANDS---------------------------------------------------
  1033. COMMAND:quitbots(playerid, params[])
  1034. {
  1035. new pname[24], string[24];
  1036. GetPlayerName(playerid, pname, sizeof(pname));
  1037. if(IsPlayerAdmin(playerid))
  1038. {
  1039. format(string, sizeof(string), "EXIT CMD BY %s(%d)",pname, playerid);
  1040. IRC_Quit(gBotID[0], string);
  1041. IRC_Quit(gBotID[1], string);
  1042. IRC_Quit(gBotID[2], string);
  1043. IRC_DestroyGroup(gGroupID);
  1044. }
  1045. return 1;
  1046. }
  1047. COMMAND:getbots(playerid, params[])
  1048. {
  1049. if(IsPlayerAdmin(playerid))
  1050. {
  1051.  
  1052. gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  1053. IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
  1054. gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
  1055. IRC_SetIntData(gBotID[1], E_IRC_CONNECT_DELAY, 30);
  1056. gBotID[2] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_3_NICKNAME, BOT_3_REALNAME, BOT_3_USERNAME);
  1057. IRC_SetIntData(gBotID[2], E_IRC_CONNECT_DELAY, 30);
  1058. gGroupID = IRC_CreateGroup();
  1059. }
  1060. return 1;
  1061. }
  1062. CMD:irc(playerid, params[])
  1063. {
  1064. new string[128];
  1065. new pname[24];
  1066. if(!strlen(params))
  1067. {
  1068. SendClientMessage(playerid,COLOR_GREEN,"USAGE: /ircpm (Message)");
  1069. return 1;
  1070. }
  1071. GetPlayerName(playerid, pname, sizeof(pname));
  1072. format(string, sizeof(string), "7,1IRC PM: %s(%d): %s",pname,playerid,params);
  1073. IRC_GroupSay(gGroupID, IRC_CHANNEL,string);
  1074.  
  1075. format(string, sizeof(string), "[IRC PM] %s(%d): %s",pname,playerid,params);
  1076. SendClientMessage(playerid,COLOR_GREEN,string);
  1077. return 1;
  1078. }
  1079. //--------------------------------FUNCTIONS----------------------------------------------------------------------
  1080. //This goes on FS/GM init
  1081. forward irc_connectoninit();
  1082. public irc_connectoninit()
  1083. {
  1084.  
  1085. gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  1086. IRC_SetIntData(gBotID[0], E_IRC_CONNECT_DELAY, 20);
  1087. gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
  1088. IRC_SetIntData(gBotID[1], E_IRC_CONNECT_DELAY, 30);
  1089. gBotID[2] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_3_NICKNAME, BOT_3_REALNAME, BOT_3_USERNAME);
  1090. IRC_SetIntData(gBotID[2], E_IRC_CONNECT_DELAY, 30);
  1091. gGroupID = IRC_CreateGroup();
  1092.  
  1093. }
  1094. // Get weapon name
  1095. stock GetDeathReason(reason)
  1096. {
  1097. new deathreason[32];
  1098. switch(reason)
  1099. {
  1100. case 0: deathreason = "Fists";
  1101. case 1: deathreason = "Brass Knuckles";
  1102. case 2: deathreason = "Golf Stick";
  1103. case 3: deathreason = "Nite Stick";
  1104. case 4: deathreason = "Knife";
  1105. case 5: deathreason = "Baseball Bat";
  1106. case 6: deathreason = "Shovel";
  1107. case 7: deathreason = "Pool Cue";
  1108. case 8: deathreason = "Katana";
  1109. case 9: deathreason = "Chainsaw";
  1110. case 10: deathreason = "Dildo";
  1111. case 11: deathreason = "Small Vibrator";
  1112. case 12: deathreason = "Large Vibrator";
  1113. case 13: deathreason = "Vibrator";
  1114. case 14: deathreason = "Flowers";
  1115. case 15: deathreason = "Cane";
  1116. case 16: deathreason = "Grenade";
  1117. case 17: deathreason = "Smoke Grenade";
  1118. case 18: deathreason = "Molotov Cocktail";
  1119. case 19: deathreason = "Vehicle Weapon";
  1120. case 20: deathreason = "Hydra Flare";
  1121. case 21: deathreason = "Jetpack";
  1122. case 22: deathreason = "9mm Pistol";
  1123. case 23: deathreason = "Silenced 9mm Pistol";
  1124. case 24: deathreason = "Desert Eagle";
  1125. case 25: deathreason = "Shotgun";
  1126. case 26: deathreason = "Sawnoff Shotgun";
  1127. case 27: deathreason = "Combat Shotgun";
  1128. case 28: deathreason = "Micro SMG";
  1129. case 29: deathreason = "MP5";
  1130. case 30: deathreason = "AK47";
  1131. case 31: deathreason = "M4";
  1132. case 32: deathreason = "Tec-9";
  1133. case 33: deathreason = "Rifle";
  1134. case 34: deathreason = "Sniper Rifle";
  1135. case 35: deathreason = "Rocket Launcherr";
  1136. case 36: deathreason = "Rocket Launcher";
  1137. case 37: deathreason = "Flamethrower";
  1138. case 38: deathreason = "Minigun";
  1139. case 39: deathreason = "Satchels";
  1140. case 40: deathreason = "Detonator";
  1141. case 41: deathreason = "Spraycan";
  1142. case 42: deathreason = "Fire Extinguisher";
  1143. case 43: deathreason = "Camera";
  1144. case 44: deathreason = "Nightvision Goggles";
  1145. case 45: deathreason = "Infrared Goggles";
  1146. case 46: deathreason = "Parachute";
  1147. case 47: deathreason = "!>>> Unknown 47 <<<!";
  1148. case 48: deathreason = "!>>> Unknown 48 <<<!";
  1149. case 49: deathreason = "Vehicle";
  1150. case 50: deathreason = "Helicopter Blades";
  1151. case 51: deathreason = "Explosion";
  1152. case 52: deathreason = "!>>> Unknown 52 <<<!";
  1153. case 53: deathreason = "!>>> Unknown 53 <<<!";
  1154. case 54: deathreason = "!>>> Unknown 54 <<<!";
  1155. case 55: deathreason = "!>>> Unknown 55 <<<!";
  1156. case 255: deathreason = "!>>> Unknown 255 <<<!";
  1157. }
  1158.  
  1159. return deathreason;
  1160. }
  1161. stock KickWithMessage(playerid, message[])
  1162. {
  1163. SendClientMessage(playerid, COLOR_RED, message);
  1164. SetTimerEx("KickPublic", 1000, 0, "d", playerid);
  1165. }
  1166. forward KickPublic(playerid);
  1167. public KickPublic(playerid)
  1168. {
  1169. Kick(playerid);
  1170. }
  1171. stock FindIP(text[])
  1172. {
  1173. new strR[255];
  1174. new is1=0;
  1175. new r=0;
  1176. while(strlen(text[is1]))
  1177. {
  1178. if('0'<=text[is1]<='9')
  1179. {
  1180. new is2=is1+1;
  1181. new p=0;
  1182. while(p==0)
  1183. {
  1184. if('0'<=text[is2]<='9'&&strlen(text[is2])) is2++;
  1185. else
  1186. {
  1187. strmid(strR[r],text,is1,is2,255);
  1188. if(strval(strR[r])<255) r++;
  1189. is1=is2;
  1190. p=1;
  1191. }
  1192. }
  1193. }
  1194. is1++;
  1195. }
  1196. if(r>=4)
  1197. {
  1198. return true;
  1199. }
  1200. else
  1201. {
  1202. return false;
  1203. }
  1204. }
  1205. stock FormatNumber(iNum, const szChar[] = ",")
  1206. {
  1207. new
  1208. szStr[16]
  1209. ;
  1210. format(szStr, sizeof(szStr), "%d", iNum);
  1211.  
  1212. for(new iLen = strlen(szStr) - 3; iLen > 0; iLen -= 3)
  1213. {
  1214. strins(szStr, szChar, iLen);
  1215. }
  1216. return szStr;
  1217. }
  1218. stock IsVehicleOccupied(vehicleid) // Returns 1 if there is anyone in the vehicle
  1219. {
  1220. foreach(Player,i)
  1221. {
  1222. if(IsPlayerInAnyVehicle(i))
  1223. {
  1224. if(GetPlayerVehicleID(i)==vehicleid)
  1225. {
  1226. return 1;
  1227. }
  1228. else
  1229. {
  1230. return 0;
  1231. }
  1232. }
  1233. }
  1234. return 1;
  1235. }
  1236.  
  1237.  
  1238. //---------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment