Advertisement
Guest User

VG4L????

a guest
Apr 24th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.08 KB | None | 0 0
  1. // IRC
  2. const FBS_NICK = "VG4L"; // The name of the echo bot
  3. const FBS_BPASS = "killer"; // The NickServ password of the echo bot
  4. const FBS_SERVER = "94.23.157.172"; // The numerical ip of the irc server - this will join irc.nl.project-apollo.co.uk
  5. const FBS_PORT = 6667; // The port for that irc server
  6. const FBS_CHAN = "#VG"; // The channel that you wont your echo bot to join
  7. const FBS_CPASS = ""; // The password for that channel, if there isnt one leave it as "".
  8.  
  9. class FBSLIST
  10. {
  11. // This is how we are going to store the user level information for each nick currently on the channel
  12. Name = null;
  13. Level = 1;
  14. }
  15.  
  16. function FBSLIST::AddNick( szNick, iAdmin )
  17. {
  18. Name = szNick;
  19. Level = iAdmin;
  20. }
  21.  
  22. function ActivateEcho()
  23. {
  24. print( "Confirming echo bot details..." );
  25. FBS_BOT <- NewSocket( "FBSProcess" );
  26.  
  27. FBS_BOT.Connect( FBS_SERVER, FBS_PORT );
  28. FBS_BOT.SetNewConnFunc( "FBSLogin" );
  29. print( "Bot details confirmed!" );
  30.  
  31. FBS_NICKS <- array( 50, null );
  32. }
  33.  
  34. function DisconnectBots()
  35. {
  36. print( "Disconnecting bot from IRC..." );
  37.  
  38. FBS_BOT.Send( "QUIT " + FBS_NICK + "\n" );
  39. FBS_BOT.Delete();
  40.  
  41. print( FBS_NICK + " has succesfully disconnected from IRC." );
  42. }
  43.  
  44. function FBSLogin()
  45. {
  46. print( "Attempting to set user, nick and mode...." );
  47. // Set the bots name and real name
  48. FBS_BOT.Send( "USER " + FBS_NICK + " 0 * :VG training server echo bot\n" );
  49. // Set the nick that the bot will use on the irc server
  50. FBS_BOT.Send( "NICK " + FBS_NICK + "\n" );
  51. // Set it so that the network classes the bot as a bot
  52. FBS_BOT.Send( "MODE " + FBS_NICK + " +B\n" );
  53. print( "Task completed successfully." );
  54. }
  55. function FBSProcess( sz )
  56. {
  57. // This function is used to process the raw data that the bot is recieving from the irc server
  58. local raw = split( sz, "\r\n" ), a, z = raw.len(), line;
  59.  
  60. for ( a = 0; a < z; a++ )
  61. {
  62. line = raw[ a ];
  63.  
  64. local FBS_PING = GetTok( line, " ", 1 ), FBS_EVENT = GetTok( line, " ", 2 ), FBS_CHANEVENT = GetTok( line, " ", 3 ),
  65. Count = NumTok( line, " " ), Nick, Command, Prefix, Text;
  66.  
  67. // The most important thing is making sure that the bot stays connected to IRC
  68. if ( FBS_PING ) FBS_BOT.Send( "PONG " + FBS_PING + "\n" );
  69.  
  70. if ( FBS_EVENT == "001" )
  71. {
  72. if ( FBS_BOT )
  73. {
  74. // Identify the bot with services, comment this line if its not registered
  75. FBS_BOT.Send( "PRIVMSG NickServ IDENTIFY " + FBS_BPASS + "\n" );
  76. // Set it so that the network classes the bot as a bot
  77. FBS_BOT.Send( "MODE " + FBS_NICK + " +B\n" );
  78. // Make the bot join the specified channel
  79. FBS_BOT.Send( "JOIN " + FBS_CHAN + " " + FBS_CPASS + "\n" );
  80. // The bot now needs to collect information about users in the channel
  81. print( "Succesfully joined " + FBS_CHAN + "!" );
  82. }
  83. }
  84. else if ( FBS_EVENT == "353" ) FBSSortNicks( sz );
  85. else if ( ( FBS_EVENT == "MODE" ) || ( FBS_EVENT == "NICK" ) || ( FBS_EVENT == "JOIN" ) || ( FBS_EVENT == "PART" ) || ( FBS_EVENT == "QUIT" ) ) FBS_BOT.Send( "NAMES :" + FBS_CHAN + "\n" );
  86. if ( FBS_CHANEVENT == FBS_CHAN )
  87. {
  88. // Grab the nick
  89. Nick = GetTok( line, "!", 1 ).slice( 1 );
  90. // Figure out what the command is
  91. Command = GetTok( line, " ", 4 );
  92. // Figure out what prefix was used
  93. Prefix = Command.slice( 1, 2 );
  94. Command = Command.slice( 1 );
  95.  
  96. // Figure out the text after the command
  97. if ( NumTok( line, " " ) > 4 ) Text = GetTok( line, " ", 5, Count );
  98. else Command = split( Command, "\r\n" )[ 0 ];
  99. // Parse the command
  100. // Parse the command
  101. /*
  102. if ( ( Prefix == "!" ) && ( Count > 4 ) ) FBSIrcCommand( Nick, Command.tolower(), Text );
  103. else if ( ( Prefix == "!" ) && ( Count == 4 ) ) FBSIrcCommand( Nick, Command.tolower(), null );
  104. */
  105. if (Nick && Command && Text) { FBSIrcCommand( Nick, Command, Text ); }
  106. else if (Nick && Command) { FBSIrcCommand( Nick, Command, null ); }
  107. }
  108. }
  109. }
  110. function LevelTag1(lvl) {
  111. lvl = (lvl ? lvl:0);
  112. switch (lvl) {
  113. case 2:
  114. return "V.I.P";
  115. case 3:
  116. return "IRC-Moderator";
  117. case 4:
  118. return "IRC-Admin";
  119. case 5:
  120. return "IRC-Manager";
  121. case 6:
  122. return "IRC-Owner";
  123. default:
  124. return "User";
  125. }
  126. }
  127. function lLevelTag(lvl) {
  128. lvl = (lvl ? lvl:0);
  129. switch (lvl) {
  130. case 2:
  131. return "11";
  132. case 3:
  133. return "7";
  134. case 4:
  135. return "3";
  136. case 5:
  137. return "4";
  138. case 6:
  139. return "12";
  140. default:
  141. return "5";
  142. }
  143. }
  144. function FBSIrcCommand( user, cmd, text )
  145. {
  146. local NickInfo = FindNick( user ), level, tLevel, p;
  147. if ( NickInfo ) level = NickInfo.Level.tointeger();
  148. if (cmd)
  149. {
  150. if (cmd.slice(0,1) == "." && cmd.len() > 1)
  151. {
  152. local msg = "=> (" + LevelTag1(level) + ")" + user + ": " + cmd.slice(1);
  153. if (text) msg = msg + " " + text;
  154. EchoMessage(lLevelTag(level) + msg);
  155. Message(msg);
  156. }
  157. }
  158.  
  159.  
  160. if ( cmd == "!say" )
  161. {
  162. if ( !text ) EchoMessage( "Error - Syntax: " + cmd + " <text> " );
  163. else
  164. {
  165. if ( level > 3 ) ::IbMessage( "* Admin " + user + ": " + text );
  166. else if ( level == 3 ) ::IbMessage( "* Moderator " + user + ": " + text );
  167. else ::IbMessage( user + ": " + text );
  168. }
  169. }
  170.  
  171. else if ( cmd == "!me" )
  172. {
  173. if ( !text ) EchoMessage( "Error - Syntax: !" + cmd + " <text> " );
  174. else ::IbMessage( user + " " + text );
  175. }
  176.  
  177.  
  178. else if ( cmd == "!players" )
  179. {
  180. local plr, buffer = "", MAX_PLAYERS = GetMaxPlayers();
  181. for( local i=0; i < MAX_PLAYERS; ++i )
  182. {
  183. plr = FindPlayer( i );
  184. if ( plr ) buffer = buffer + " " + plr.Name + "[" + plr.ID + "]";
  185. }
  186. if ( buffer != "" ) EchoMessage( "Online Players: " + strip(buffer) );
  187. EchoMessage( "Total players: " + GetPlayers() );
  188. }
  189.  
  190.  
  191. else if ( ( cmd == "!admin" ) || ( cmd == "!admins" ) )
  192. {
  193. local a = 0, b = null;
  194. while ( a < GetMaxPlayers() )
  195. {
  196. local plr = GetPlayer( a );
  197. if ( plr )
  198. {
  199. local lvl = GetLevel( plr );
  200.  
  201. if ( lvl >= 2 )
  202. {
  203. if ( b ) b = b + " - " + plr.Name + " ";
  204. else b = plr.Name + " ";
  205. }
  206. }
  207. a ++;
  208. }
  209. if ( b ) { EchoMessage( ICOL_BLUE + "*--> Admins Online: " + b ); }
  210. else EchoMessage( ICOL_RED + "No Admins Online." );
  211. }
  212.  
  213.  
  214. else if ( cmd == "!ping" )
  215. {
  216. if ( !text ) EchoMessage( "Error - Syntax: " + cmd + " <Nick/ID> " );
  217. else
  218. {
  219. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  220. if ( !plr ) EchoMessage( "Invalid Player..." );
  221. IbMessage( "" + plr.Name + "'s Ping: " + plr.Ping + ". " );
  222. }
  223. }
  224.  
  225.  
  226. else if ( cmd == "!server" )
  227. {
  228. EchoMessage( ICOL_PURPLE + "Server Name: " + GetServerName() );
  229. EchoMessage( ICOL_ORANGE + "Game-Mode: " + GetGamemodeName() );
  230. EchoMessage( ICOL_LGREEN + "Map: " + GetMapName() );
  231. EchoMessage( ICOL_PINK + "Player Slots: " + GetMaxPlayers() );
  232. }
  233.  
  234.  
  235. else if ( cmd == "!script" )
  236. {
  237. EchoMessage( ICOL_PURPLE + "Server by Thompson " );
  238. EchoMessage( ICOL_ORANGE + "Version:VG 0.1" );
  239. }
  240.  
  241. else if ( cmd == "!country" )
  242. {
  243. if ( !text ) EchoMessage( "Error - !country <Nick/ID>." );
  244. else
  245. {
  246. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  247. if ( !plr ) EchoMessasge( "Error: Invalid Player." );
  248. local IP = plr.IP;
  249. local country = geoip_country_name_by_addr(plr.IP);
  250. EchoMessage( "" + plr + "'s Country: " + country + ". [" + geoip_country_code_by_addr(plr.IP) + "]" );
  251. }
  252. }
  253.  
  254.  
  255. else if ( cmd == "!lvl" )
  256. {
  257. if ( !text ) EchoMessage( "Error - !lvl <Nick/ID>." );
  258. else
  259. {
  260. local plr = GetPlayer( GetTok( text, " ", 1 ) ), le = GetLevel( plr );
  261. if ( !plr ) EchoMessage( user, "Error: Invalid Player." );
  262. EchoMessage( "" + plr + "'s Level:[ " + GetLevel( plr ) + " ] Group:[ " + LevelTag( plr ) + " ]" );
  263. }
  264. }
  265.  
  266.  
  267. else if ( cmd == "!arm" )
  268. {
  269. if ( !text ) EchoMessage("Error - Syntax: " + cmd + " <Nick/ID>");
  270. else
  271. {
  272. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  273. if ( !plr ) EchoMessage("Error - Invalid Nick/ID");
  274. EchoMessage("["+plr.ID+"] "+plr+" Armour:[ "+plr.Armour+"'% ]");
  275. }
  276. }
  277.  
  278.  
  279. else if ( cmd == "!hp" )
  280. {
  281. if ( !text ) EchoMessage("Error - Syntax: " + cmd + " <Nick/ID>");
  282. else
  283. {
  284. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  285. if ( !plr ) EchoMessage("Error - Invalid Nick/ID");
  286. EchoMessage("["+plr.ID+"] "+plr+" Health:[ "+plr.Health+"'% ]");
  287. }
  288. }
  289.  
  290.  
  291. else if ( ( cmd == "!cmds" ) || ( cmd == "!commands" ) )
  292. {
  293. EchoMessage( ICOL_ORANGE + " !hp, !arm, !say, !me, !players, !admins, !script, !lvl, !ping, !server, !country ." );
  294. }
  295.  
  296.  
  297. else if ( ( cmd == "!ircrules" ) || ( cmd == "!ircrules" ) )
  298. {
  299. EchoMessage( ICOL_ORANGE + " No flaming, no spamming, no unban requesting, no level requesting ." );
  300. }
  301. /// Admin Cmds
  302. else if ( ( cmd == "!acmds" ) || ( cmd == "!admincmds" ) )
  303. {
  304. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  305. else EchoNotice( user, ICOL_LGREEN + " !exe, !getip, !ann, !freeze, !unfreeze, !annall, !slap, !drown, !kill, !mute" );
  306. }
  307.  
  308. else if ( cmd == "!drown" )
  309. {
  310. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  311. else if ( !text ) EchoNotice( user, ICOL_RED + "Error - Syntax: " + cmd + " <Nick/ID> <Reason> ");
  312. else
  313. {
  314. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  315. if ( !plr ) EchoNotice( user, "Error - Unknown player." );
  316. else
  317. {
  318. local msg = GetTok( text, " ", 2, NumTok( text, " " ) );
  319. if ( !msg ) EchoNotice( user, "Error - Invalid format." );
  320. else
  321. {
  322. EchoMessage( ICOL_LGREEN + "Drowned Player:[ " + plr.Name + " ]. Reason:[ " + msg + " ]" );
  323. Message( "Admin " + user + " has drowned " + plr.Name + ". Reason: " + msg + "." );
  324. plr.Pos = Vector( 283.521 , -1574.3 , 7.19846 );
  325. }
  326. }
  327. }
  328. }
  329.  
  330.  
  331. else if ( cmd == "!kill" )
  332. {
  333. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  334. else if ( !text ) EchoNotice( user, ICOL_RED + "Error - Syntax: " + cmd + " <Nick/ID> <Reason> ");
  335. else
  336. {
  337. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  338. if ( !plr ) EchoNotice( user, "Error - Unknown player." );
  339. else
  340. {
  341. local msg = GetTok( text, " ", 2, NumTok( text, " " ) );
  342. if ( !msg ) EchoNotice( user, "Error - Invalid format." );
  343. else
  344. {
  345. EchoMessage( ICOL_LGREEN + "Killed Player:[ " + plr.Name + " ]. Reason:[ " + msg + " ]" );
  346. Message( "Admin " + user + " has killed " + plr.Name + ". Reason: " + msg + "." );
  347. plr.Pos = plr.Pos
  348. plr.Health = 0;
  349. }
  350. }
  351. }
  352. }
  353.  
  354.  
  355. else if ( cmd == "!slap" )
  356. {
  357. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  358. else
  359. {
  360. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  361. if ( !plr ) EchoNotice( user, "Error - Invalid player." );
  362. IbMessage( "Admin " + user + " has slapped " + plr.Name + "." );
  363. plr.Health -= 20;
  364. }
  365. }
  366.  
  367. else if ( cmd == "!ann" )
  368. {
  369. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  370. else if ( !text ) EchoNotice( user, ICOL_RED + "Error - Syntax: " + cmd + " <Nick/ID/all> <Message> ");
  371. else if (GetTok( text, " ", 1 ).tolower() =="all")
  372. {
  373. local msg = GetTok( text, " ", 2, NumTok( text, " " ) );
  374. AnnounceAll( msg );
  375. EchoMessage( ICOL_LGREEN + "Sent Announcement:[ " + msg + " ] to all players" );
  376. }
  377. else
  378. {
  379. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  380. if ( !plr ) EchoNotice( user, "Unknow player." );
  381. else
  382. {
  383. local msg = GetTok( text, " ", 2, NumTok( text, " " ) );
  384. Announce( msg, plr, 0 );
  385. EchoMessage( ICOL_LGREEN + "Sent Announcement:[ " + msg + " ] to:[ " + plr.Name + " ]" );
  386. }
  387. }
  388. }
  389.  
  390.  
  391. else if ( cmd == "!annall" )
  392. {
  393. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  394. else if ( !text ) EchoNotice( user, ICOL_RED + "Error Syntax: " + cmd + " <Message>");
  395. else
  396. {
  397. local msg = GetTok( text, " ", 2,NumTok( text, " "));
  398. AnnounceAll( text, 0);
  399. EchoMessage( ICOL_LGREEN + " " + user + " Sent Announcement to all players in game. Message:[ " + text + " ]" );
  400. }
  401. }
  402.  
  403.  
  404. else if ( cmd == "!freeze" )
  405. {
  406. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  407. else if ( !text ) EchoNotice( user, ICOL_RED + "Error - Syntax: " + cmd + " <Nick/ID> <Reason> ");
  408. else
  409. {
  410. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  411. if ( !plr ) EchoNotice( user, "Error - Unknow player." );
  412. else
  413. {
  414. local msg = GetTok( text, " ", 2, NumTok( text, " " ) );
  415. if ( !msg ) EchoNotice( user, "Error - Invalid format." );
  416. else
  417. {
  418. EchoMessage( ICOL_LGREEN + "Freezed Player:[ " + plr.Name + " ]. Reason:[ " + msg + " ]" );
  419. Message( "Admin " + user + " has frozen " + plr.Name + ". Reason: " + msg + "." );
  420. plr.IsFrozen = true;
  421. }
  422. }
  423. }
  424. }
  425.  
  426.  
  427. else if ( cmd == "!mute" )
  428. {
  429. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  430. else if ( !text ) EchoNotice( user, ICOL_RED + "Error - Syntax: " + cmd + " <Nick/ID> <Reason> ");
  431. else
  432. {
  433. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  434. if (!plr) EchoNotice( user, " Error - Unknown player" );
  435. else
  436. {
  437. local msg = GetTok( text, " ", 2, NumTok( text, " " ) );
  438. if ( !msg ) EchoNotice( user, "Error - Invalid format." );
  439. else
  440. {
  441. EchoMessage( ICOL_LGREEN + "Muted Player:[ " + plr.Name + " ]. Reason:[ " + msg + " ]" );
  442. Message( "Admin " + user + " has muted " + plr.Name + " ]. Reason: " + msg + "." );
  443. plr.IsMuted = true;
  444. }
  445. }
  446. }
  447. }
  448.  
  449. else if ( cmd == "!unmute" )
  450. {
  451. if ( level < 3 ) EchoNotice( user, ICOL_RED + "Error - Your level is not high enough to use that command." );
  452. else if ( !text ) EchoNotice( user, ICOL_RED + " Error - Syntax: !unmute <Nick/ID>" );
  453. else
  454. {
  455. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  456. if (!plr) EchoNotice( user, " Error - Unknown Player" );
  457. else
  458. {
  459. EchoMessage( ICOL_BROWN + " Admin " + user + " has un-muted Player " + plr.Name + "." );
  460. Message( "Admin " + user + " has un-muted " + plr.Name + "." );
  461. plr.IsMuted = false;
  462. }
  463. }
  464. }
  465.  
  466.  
  467. else if ( cmd == "!unfreeze" )
  468. {
  469. if ( level < 3 ) EchoNotice( user, ICOL_RED + " Error - Your level is not high enough." );
  470. else if ( !text ) EchoNotice( user, ICOL_RED + " Error - Syntax: !unfreeze <Nick/ID>" );
  471. else
  472. {
  473. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  474. if (!plr) EchoNotice( user, " Error - Unknown Player" );
  475. else
  476. {
  477. EchoMessage( ICOL_BLUE + "Admin " + user + " has un-frozen " + plr.Name + "." );
  478. Message( " **Admin " + user + " has un-frozen " + plr.Name + "." );
  479. plr.IsFrozen = false;
  480. }
  481. }
  482. }
  483.  
  484. else if ( cmd == "!kick" )
  485. {
  486. if ( level < 3 ) EchoNotice( user, ICOL_RED + " Error - Your level is not high enough." );
  487. else if ( !text ) EchoNotice( user, ICOL_RED + "Error: Syntax, " + cmd + " <Nick/ID> <Reason>" );
  488. else
  489. {
  490. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  491. if ( !plr ) EchoNotice( user, ICOL_RED + "Invalid Player." );
  492. else
  493. {
  494. local reason = GetTok( text, " ", 2, NumTok( text, " " ) );
  495. if ( reason == null ) reason = "None";
  496. else
  497. {
  498. EchoMessage( ICOL_BLUE + "Admin " + user + " has kicked " + plr.Name + " Reason:[ " + reason + " ]." );
  499. Message( " ** Admin " + user + " has kicked " + plr.Name + " Reason:[ " + reason + " ]." );
  500. KickPlayer( plr );
  501. }
  502. }
  503. }
  504. }
  505.  
  506. else if ( cmd == "!ban" )
  507. {
  508. if ( level < 4 ) EchoNotice( user, ICOL_RED + " Error - Your level is not high enough." );
  509. else if ( !text ) EchoNotice( user, ICOL_RED + "Error: Syntax, " + cmd + " <Nick/ID> <Reason>" );
  510. else
  511. {
  512. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  513. if ( !plr ) PrivMessage( "Invalid Player Nick / ID!", player );
  514. else
  515. {
  516. local reason = GetTok( text, " ", 2 NumTok( text, " " ) );
  517. if ( reason == null ) reason = "None";
  518. else
  519. {
  520. QuerySQL( db, "INSERT INTO Bans ( Name, IP, Admin, Reason ) VALUES ( '" + player.Name + "', '" + player.IP + "', '" + user + "', '" + reason + "' )" );
  521. EchoMessage( "** Admin " + admin + " banned " + player.Name + " Reason: " + reason );
  522. Message( "** Admin " + admin + " banned " + player.Name + " Reason: " + reason );
  523. KickPlayer( player );
  524. }
  525. }
  526. }
  527. }
  528.  
  529. else if( cmd == "!exe" )
  530. {
  531. if ( !text ) EchoMessage( ICOL_RED + "Error - Syntax: !exec <Squirrel code>" );
  532. else if( level < 6 ) EchoNotice( user, ICOL_RED + "You have to be an admin to use such commands." );
  533. else
  534. {
  535. try
  536. {
  537. local script = compilestring( text );
  538. if(script)
  539. {
  540. script();
  541. EchoMessage( "4 command executed successfully!" );
  542. }
  543. else EchoMessage( "4 error!" );
  544.  
  545. }
  546. catch(e) EchoMessage( "Error:" + e );
  547. }
  548. }
  549.  
  550.  
  551. else if ( cmd == "!getip")
  552. {
  553. if ( !text ) EchoMessage( ICOL_RED + "Error - Syntax: !getip <Nick/ID>" );
  554. else if( level < 3 ) EchoNotice( user, ICOL_RED + "You have to be an admin to use such commands." );
  555. else
  556. {
  557. local plr = GetPlayer( GetTok( text, " ", 1 ) );
  558. if (!plr) EchoNotice( user, " Error - Unknown Player" );
  559. else
  560. {
  561. EchoNotice( user, ICOL_BLUE + " " + plr.Name + " IP:[ " + plr.IP + "]." );
  562. }
  563. }
  564. }
  565. }
  566.  
  567. function EchoNotice( nick, text )
  568. {
  569. // Send A notice :)
  570. FBS_BOT.Send( "NOTICE " + nick + " " + text + "\n" );
  571. }
  572.  
  573. function EchoMessage( text )
  574. {
  575. // This is used for events such as a player joining
  576. // EchoMessage( "** [" + player.ID + "] " + player + " has joined the server." );
  577. FBS_BOT.Send( "PRIVMSG " + FBS_CHAN + " " + text + "\n" );
  578. }
  579.  
  580. function NewsMessage( text )
  581. {
  582. ClientMessageToAll( text, 255, 255, 0 );
  583. }
  584.  
  585. /* The following functions below are to do with parsing nick information and levels
  586. DO NOT TOUCH ANYTHING BELOW THIS LINE.......EVER!
  587. */
  588.  
  589. function FBSSortNicks( szList )
  590. {
  591. local a = NumTok( szList, " " );
  592. local NickList = GetTok( szList, " ", 6, a ), i = 1;
  593.  
  594. FBS_NICKS <- array( 50, null );
  595.  
  596. while( GetTok( NickList, " ", i ) != "366" )
  597. {
  598. local levelnick = GetTok( NickList, " ", i ), nick = levelnick.slice( 1 ), level = levelnick.slice( 0, 1 );
  599.  
  600. if ( level == ":" ) { level = nick.slice( 0, 1 ); nick = nick.slice( 1 ); }
  601.  
  602. if ( level == "+" ) AddNewNick( nick, 2 );
  603. else if ( level == "%" ) AddNewNick( nick, 3 );
  604. else if ( level == "@" ) AddNewNick( nick, 4 );
  605. else if ( level == "&" ) AddNewNick( nick, 5 );
  606. else if ( level == "~" ) AddNewNick( nick, 6 );
  607. else AddNewNick( nick, 1 );
  608. i ++;
  609. }
  610. }
  611.  
  612. function AddNewNick( szName, iLevel )
  613. {
  614. local i = FindFreeNickSlot();
  615.  
  616. if ( i != -1 )
  617. {
  618. FBS_NICKS[ i ] = FBSLIST();
  619. FBS_NICKS[ i ].AddNick( szName, iLevel );
  620. }
  621. }
  622.  
  623. function FindFreeNickSlot()
  624. {
  625. for ( local i = 0; i < FBS_NICKS.len(); i++ )
  626. {
  627. if ( !FBS_NICKS[ i ] ) return i;
  628. }
  629. return -1;
  630. }
  631.  
  632. function FindNick( szName )
  633. {
  634. for ( local i = 0; i < FBS_NICKS.len(); i++ )
  635. {
  636. if ( FBS_NICKS[ i ] )
  637. {
  638. if ( FBS_NICKS[ i ].Name == szName ) return FBS_NICKS[ i ];
  639. }
  640. }
  641. return null;
  642. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement