Guest User

Untitled

a guest
Feb 22nd, 2009
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.16 KB | None | 0 0
  1. #include <a_samp>
  2. #pragma tabsize 0
  3.  
  4. /*
  5.  
  6. Simple irc echo filterscript
  7. Brought to you by [NB]Sneaky
  8.  
  9. www.99BlaZed.com
  10. www.sneakyhost.net
  11.  
  12. Player Commands:
  13.  
  14. !imsg <send message to server>
  15. !igetid <get a players id based on nickname>
  16.  
  17. Admin Commands:
  18.  
  19. !iban <ban a player with optional reason>
  20. !ikick <kick a player with optional reason>
  21. !islap <slap a player with optional reason>
  22. !ikill <kill a player with optional reason>
  23. !isay <send message to the server as admin>
  24. !ipause <pause the echo, !pause again to unpause>
  25.  
  26. DO NOT REMOVE CREDITS!
  27. That's all I ask.
  28.  
  29. */
  30.  
  31. #define irccmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (irccmd_%1(conn,channel,user,"")))||(((%3)[(%2) + 1] == 32) && (irccmd_%1(conn,channel,user,(%3)[(%2) + 2]))))) return 1
  32.  
  33. // Setup settings here
  34.  
  35. #define IRC_SERVER "irc.gtanet.com" // IRC Server (e.g irc.gtanet.com)
  36. #define IRC_PORT 6667 // Set the IRC port (default 6667)
  37.  
  38. // Uncomment line 39 if you want to use 2 bots, uncomment line 40 if you want to use 3 bots
  39. #define IRC_AMOUNT1 true
  40. //#define IRC_AMOUNT2 true
  41. //#define IRC_AMOUNT3 true
  42.  
  43. // Put the names of your irc bot's here (Note: not every bot can have the same name)
  44. #define IRC_ECHO_BOT1 "MatBot"
  45. #define IRC_ECHO_BOT2 "BotServer"
  46. #define IRC_ECHO_BOT3 "MatBot"
  47.  
  48. // #channel is the channel you want to echo in game chat in, change it.
  49. #define IRC_ECHO_CHAN "#Matthias"
  50.  
  51. // If your bot names are registered put a password here to identify them with
  52. #define IRC_PASSWORD "botnaam"
  53.  
  54. // Set the IRC join delay (1000 = 1 second), set to 0 if you dont want to use it
  55. // (IF bot has a vHost then set this to 5000 ELSE it wont show the vHost on channel join)
  56. #define IRC_JOIN_DELAY 0
  57.  
  58. // PRETTY SELF EXPLANARY
  59.  
  60. #define IRC_QUIT_MSG "The server is going offline now"
  61. #define IRC_AUTH_MSG "The server is online now!"
  62. #define IRC_INTI_MSG1 "[Info] ------ ..::: Las Venturas Mayhem :::.. initializing ------"
  63. #define IRC_INTI_MSG2 "[Info] ----------------------------------------------------------"
  64. #define IRC_INTI_MSG3 "[Info] ------------- Server succesfully started------------------"
  65. #define IRC_INTI_MSG4 "[Info] ----------------------------------------------------------"
  66. #define IRC_INTI_MSG5 "[Info] ----------- Current IP: 209.250.250.179:7777 ------------"
  67.  
  68. native ircGetUserLevel(conn, channel[], user[], dest[]);
  69. native ircGetUserList(conn, channel[], dest[], size);
  70. native ircSetMode(conn, channel[], modes[], nicks[]);
  71. native ircConnect(server[], port, user[]);
  72. native ircSay(conn, channel[], message[]);
  73. native ircSendRawData(conn, rawdata[]);
  74. native ircJoinChan(conn, channel[]);
  75. native ircPartChan(conn, channel[]);
  76. native ircDisconnect(conn);
  77. native ircPollEvents();
  78.  
  79. forward ircOnUserSay(conn, channel[], user[], message[]);
  80. forward ircOnUserPart(conn, channel[], user[]);
  81. forward ircOnUserJoin(conn, channel[], user[]);
  82. forward Float:GetDistanceBetweenPlayers(p1,p2);
  83. forward EchoConnectionCheck();
  84. forward IrcPollEventsTimer();
  85. forward DelayedChannelJoin();
  86. forward ircOnConnect(conn);
  87. forward IrcSay(Message[]);
  88.  
  89. stock
  90. EchoConnection[3],
  91. EchoBot = 0,
  92. ConnE,
  93. Echo_Paused = 0;
  94.  
  95. // Simon
  96. new aWeaponNames[][32] = {
  97. {"Unarmed (Fist)"}, // 0
  98. {"Brass Knuckles"}, // 1
  99. {"Golf Club"}, // 2
  100. {"Night Stick"}, // 3
  101. {"Knife"}, // 4
  102. {"Baseball Bat"}, // 5
  103. {"Shovel"}, // 6
  104. {"Pool Cue"}, // 7
  105. {"Katana"}, // 8
  106. {"Chainsaw"}, // 9
  107. {"Purple Dildo"}, // 10
  108. {"Big White Vibrator"}, // 11
  109. {"Medium White Vibrator"}, // 12
  110. {"Small White Vibrator"}, // 13
  111. {"Flowers"}, // 14
  112. {"Cane"}, // 15
  113. {"Grenade"}, // 16
  114. {"Teargas"}, // 17
  115. {"Molotov"}, // 18
  116. {" "}, // 19
  117. {" "}, // 20
  118. {" "}, // 21
  119. {"Colt 45"}, // 22
  120. {"Colt 45 (Silenced)"}, // 23
  121. {"Desert Eagle"}, // 24
  122. {"Normal Shotgun"}, // 25
  123. {"Sawnoff Shotgun"}, // 26
  124. {"Combat Shotgun"}, // 27
  125. {"Micro Uzi (Mac 10)"}, // 28
  126. {"MP5"}, // 29
  127. {"AK47"}, // 30
  128. {"M4"}, // 31
  129. {"Tec9"}, // 32
  130. {"Country Rifle"}, // 33
  131. {"Sniper Rifle"}, // 34
  132. {"Rocket Launcher"}, // 35
  133. {"Heat-Seeking Rocket Launcher"}, // 36
  134. {"Flamethrower"}, // 37
  135. {"Minigun"}, // 38
  136. {"Satchel Charge"}, // 39
  137. {"Detonator"}, // 40
  138. {"Spray Can"}, // 41
  139. {"Fire Extinguisher"}, // 42
  140. {"Camera"}, // 43
  141. {"Night Vision Goggles"}, // 44
  142. {"Infrared Vision Goggles"}, // 45
  143. {"Parachute"}, // 46
  144. {"Fake Pistol"} // 47
  145. };
  146.  
  147. new aDisconnectNames[][16] = {
  148. {"Timeout"}, // 0
  149. {"Leaving"}, // 1
  150. {"Kicked"} // 2
  151. };
  152.  
  153. public OnFilterScriptInit()
  154. {
  155. print("\t============================================");
  156. print("\tIRC Filterscript");
  157. print("\tBy: Sneaky");
  158. print("\t-");
  159. print("\tLoaded..");
  160. print("\t============================================");
  161. #if defined IRC_AMOUNT1
  162. {
  163. EchoConnection[0] = ircConnect(IRC_SERVER, IRC_PORT, IRC_ECHO_BOT1);
  164. }
  165. #endif
  166. #if defined IRC_AMOUNT2
  167. {
  168. EchoConnection[1] = ircConnect(IRC_SERVER, IRC_PORT, IRC_ECHO_BOT2);
  169. }
  170. #endif
  171. #if defined IRC_AMOUNT3
  172. {
  173. EchoConnection[2] = ircConnect(IRC_SERVER, IRC_PORT, IRC_ECHO_BOT3);
  174. }
  175. #endif
  176. return 1;
  177. }
  178.  
  179. public OnFilterScriptExit()
  180. {
  181. print("\t============================================");
  182. print("\tIRC Filterscript");
  183. print("\tBy: Sneaky");
  184. print("\t-");
  185. print("\tLoaded..");
  186. print("\t============================================");
  187. #if defined IRC_AMOUNT1
  188. {
  189. ircSendRawData(EchoConnection[0], "QUIT "IRC_QUIT_MSG"");
  190. }
  191. #endif
  192. #if defined IRC_AMOUNT2
  193. {
  194. ircSendRawData(EchoConnection[1], "QUIT "IRC_QUIT_MSG"");
  195. }
  196. #endif
  197. #if defined IRC_AMOUNT3
  198. {
  199. ircSendRawData(EchoConnection[2], "QUIT "IRC_QUIT_MSG"");
  200. }
  201. #endif
  202. return 1;
  203. }
  204.  
  205. public ircOnConnect(conn)
  206. {
  207. SetTimer("DelayedChannelJoin",IRC_JOIN_DELAY,0);
  208. SetTimer("IrcPollEventsTimer", 500, 1);
  209.  
  210. #if defined IRC_AMOUNT1
  211. {
  212. ircSendRawData(EchoConnection[0], "PRIVMSG NickServ :IDENTIFY "IRC_PASSWORD" ");
  213. }
  214. #endif
  215. #if defined IRC_AMOUNT2
  216. {
  217. ircSendRawData(EchoConnection[1], "PRIVMSG NickServ :IDENTIFY "IRC_PASSWORD" ");
  218. }
  219. #endif
  220. #if defined IRC_AMOUNT3
  221. {
  222. ircSendRawData(EchoConnection[2], "PRIVMSG NickServ :IDENTIFY "IRC_PASSWORD" ");
  223. }
  224. #endif
  225. return 1;
  226. }
  227.  
  228. public IrcPollEventsTimer()
  229. {
  230. ircPollEvents();
  231. return 1;
  232. }
  233.  
  234. public DelayedChannelJoin()
  235. {
  236. #if defined IRC_AMOUNT1
  237. {
  238. ircJoinChan(EchoConnection[0], IRC_ECHO_CHAN);
  239. ircJoinChan( EchoConnection[ 1 ] , "#Matthias" );
  240. ircJoinChan( EchoConnection[ 2 ] , "#GTA_Rules" );
  241. IrcSay("4"IRC_INTI_MSG1"");
  242. IrcSay("4"IRC_INTI_MSG2"");
  243. IrcSay("4"IRC_INTI_MSG3"");
  244. IrcSay("4"IRC_INTI_MSG4"");
  245. IrcSay("4"IRC_INTI_MSG5"");
  246. IrcSay("14Check !commands to see all commands!");
  247. IrcSay("10[Info] Scripted by Matthias - Hosted by Raymond - Host given by Barry");
  248.  
  249.  
  250. }
  251. #endif
  252. #if defined IRC_AMOUNT2
  253. {
  254. ircJoinChan(EchoConnection[1], IRC_ECHO_CHAN);
  255. }
  256. #endif
  257. #if defined IRC_AMOUNT3
  258. {
  259. ircJoinChan(EchoConnection[2], IRC_ECHO_CHAN);
  260. }
  261. #endif
  262. return 1;
  263. }
  264.  
  265. public IrcSay(Message[]) return ircSay(BotSwitcher(), IRC_ECHO_CHAN, Message);
  266.  
  267. public OnPlayerText(playerid, text[])
  268. {
  269. new
  270. tString[128],PlayerName[24];
  271.  
  272. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  273.  
  274. if(Echo_Paused == 0)
  275. {
  276. format(tString, sizeof(tString), "12[%d]7 %s:1 %s", playerid, PlayerName, text);
  277. IrcSay(tString);
  278. }
  279. return 1;
  280. }
  281.  
  282. public OnPlayerDeath(playerid, killerid, reason)
  283. {
  284. new
  285. tString[128],pName[128],kName[128];
  286.  
  287. GetPlayerName(killerid, kName,sizeof(kName));
  288. GetPlayerName(playerid, pName,sizeof(pName));
  289.  
  290. if(Echo_Paused == 0)
  291. {
  292. if(reason == 255)
  293. {
  294. format(tString,sizeof(tString),"3%s died.",pName);
  295. IrcSay(tString);
  296. }
  297. else
  298. {
  299. format(tString,sizeof(tString),"3%s was killed by %s (Weapon: %s - Distance: %.0f ft)",pName,kName,aWeaponNames[reason],GetDistanceBetweenPlayers(playerid,killerid));
  300. IrcSay(tString);
  301. }
  302. }
  303. return 1;
  304. }
  305.  
  306. public OnPlayerConnect(playerid)
  307. {
  308. new
  309. tString[64],PlayerName[24];
  310.  
  311. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  312. if(Echo_Paused == 0)
  313. {
  314.  
  315. format(tString, sizeof(tString), "3%s joined the server.", PlayerName);
  316. ircSay(EchoConnection[0], IRC_ECHO_CHAN, tString);
  317. }
  318. return 1;
  319. }
  320.  
  321. public OnPlayerDisconnect(playerid, reason)
  322. {
  323. new
  324. tString[64],PlayerName[24];
  325.  
  326. GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
  327.  
  328. if(Echo_Paused == 0)
  329. {
  330. format(tString, sizeof(tString), "3%s has left the server. (%s)", PlayerName, aDisconnectNames[reason]);
  331. ircSay(EchoConnection[0], IRC_ECHO_CHAN, tString);
  332. }
  333. return 1;
  334. }
  335.  
  336.  
  337. stock BotSwitcher()
  338. {
  339. #if defined IRC_AMOUNT1
  340. {
  341. switch(EchoBot)
  342. {
  343. case 0:
  344. {
  345. ConnE = EchoConnection[0];
  346. EchoBot = 0;
  347. }
  348. }
  349. }
  350. #endif
  351. #if defined IRC_AMOUNT2
  352. {
  353. switch(EchoBot)
  354. {
  355. case 0:
  356. {
  357. ConnE = EchoConnection[0];
  358. EchoBot = 1;
  359. }
  360. case 1:
  361. {
  362. ConnE = EchoConnection[1];
  363. EchoBot = 0;
  364. }
  365. }
  366. }
  367. #endif
  368. #if defined IRC_AMOUNT3
  369. {
  370. switch(EchoBot)
  371. {
  372. case 0:
  373. {
  374. ConnE = EchoConnection[0];
  375. EchoBot = 1;
  376. }
  377. case 1:
  378. {
  379. ConnE = EchoConnection[1];
  380. EchoBot = 2;
  381. }
  382. case 2:
  383. {
  384. ConnE = EchoConnection[2];
  385. EchoBot = 0;
  386. }
  387. }
  388. }
  389. #endif
  390. return ConnE;
  391. }
  392.  
  393. stock ircIsOp(conn,channel[],user[])
  394. {
  395. new
  396. ircLevel[4];
  397.  
  398. ircGetUserLevel(conn, channel, user, ircLevel);
  399.  
  400. if(!strcmp(ircLevel, "~", true,1) || !strcmp(ircLevel, "&", true,1) || !strcmp(ircLevel, "@", true,1)) return 1;
  401. return 0;
  402. }
  403.  
  404. public ircOnUserSay(conn, channel[], user[], message[])
  405. {
  406. if(message[0] != '!') return 1;
  407.  
  408. // Admin (+o / @ | +qo / ~ | +a / &) commands here
  409. irccmd(ipause,6,conn,channel,user,message);
  410. irccmd(ikick,5,conn,channel,user,message);
  411. irccmd(ikill,5,conn,channel,user,message);
  412. irccmd(iheal,5,conn,channel,user,message);
  413. irccmd(islap,5,conn,channel,user,message);
  414. irccmd(isay,4,conn,channel,user,message);
  415. irccmd(iban,4,conn,channel,user,message);
  416. irccmd(gmx,3, conn, channel, user, message);
  417. irccmd(players, 7, conn, channel, user, message);
  418. irccmd(explode, 7, conn, channel, user, message);
  419. irccmd(freeze, 6, conn, channel, user, message);
  420. irccmd(unfreeze, 8, conn, channel, user, message);
  421.  
  422.  
  423. // Player (N/A | +v | +h / %) commands here
  424. irccmd(imsg,4,conn,channel,user,message);
  425. irccmd(igetid,6,conn,channel,user,message);
  426. irccmd(commands,8,conn,channel,user,message);
  427.  
  428. return 1;
  429. }
  430.  
  431. // Player Commands
  432.  
  433. irccmd_commands(conn, channel[], user[], params[])
  434. {
  435. #pragma unused params
  436. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  437. IrcSay("10UserCommands: !imsg !igetid !commands ");
  438. IrcSay("10AdminCommands: !ikick / !iban / !ipause / !islap / !ikill / !isay /");
  439. IrcSay("!gmx / !freeze / !unfreeze / !iheal / ");
  440. return 1;
  441. }
  442.  
  443. irccmd_imsg(conn, channel[], user[], params[])
  444. {
  445. #pragma unused conn,channel
  446.  
  447. new
  448. tString[128];
  449.  
  450. if(!strlen(params)) return IrcSay("USAGE: !imsg <message>");
  451.  
  452. format(tString,sizeof(tString), ">> Player from IRC %s: %s", user, params);
  453. SendClientMessageToAll(0xFFFFFFAA, tString);
  454.  
  455. IrcSay(tString);
  456. return 1;
  457. }
  458.  
  459. irccmd_igetid(conn, channel[], user[], params[])
  460. {
  461. #pragma unused conn,channel,user
  462.  
  463. new
  464. idx,tString[128],
  465. param[20], PlayerName[24];
  466.  
  467. param = strtok(params, idx);
  468.  
  469. if (!strlen(param))
  470. return IrcSay ("USAGE: !igetid <nickname>");
  471.  
  472. new
  473. count = 0;
  474.  
  475. for (new i=0; i<GetMaxPlayers() && count<10; i++)
  476. {
  477. if (IsPlayerConnected(i))
  478. {
  479. GetPlayerName(i, PlayerName, sizeof(PlayerName));
  480. for (new j=0, k=(strlen(PlayerName)-strlen(param)); j<=k; j++)
  481. {
  482. if (strcmp(param, PlayerName[j], true, strlen(param)) == 0)
  483. {
  484. format(tString, sizeof(tString), "%s%s(%d), ", tString, PlayerName, i);
  485. count++;
  486. break;
  487. }
  488. }
  489. }
  490. }
  491. if (strlen(tString))
  492. {
  493. format(tString, sizeof(tString), "Matches: %s", tString);
  494. tString[strlen(tString) - 2] = 0;
  495. }
  496. else
  497. {
  498. format(tString, sizeof(tString), "No matches for: %s", param);
  499. }
  500. IrcSay(tString);
  501. return 1;
  502. }
  503.  
  504. // Admin Commands
  505.  
  506. irccmd_freeze(conn, channel[], user[], message[])
  507. {
  508. new idx;
  509. new tmp[256];
  510. tmp = strtok(message, idx);
  511.  
  512. if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  513. if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  514. if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  515.  
  516. TogglePlayerControllable(strval(tmp), 0);
  517.  
  518. new oname[MAX_PLAYER_NAME];
  519. GetPlayerName(strval(tmp), oname, sizeof(oname));
  520.  
  521. new string[256];
  522. format(string, sizeof(string), "\"%s\" has been frozen by IRC admin \"%s\"", oname, user);
  523.  
  524. SendClientMessageToAll(0xFF0000AA, string);
  525. ircSay(conn, channel, string);
  526. return 1;
  527. }
  528.  
  529. irccmd_unfreeze(conn, channel[], user[], message[])
  530. {
  531. new idx;
  532. new tmp[256];
  533. tmp = strtok(message, idx);
  534.  
  535. if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  536. if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  537. if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  538.  
  539. TogglePlayerControllable(strval(tmp), 1);
  540.  
  541. new oname[MAX_PLAYER_NAME];
  542. GetPlayerName(strval(tmp), oname, sizeof(oname));
  543.  
  544. new string[256];
  545. format(string, sizeof(string), "\"%s\" has been unfrozen by IRC admin \"%s\"", oname, user);
  546.  
  547. SendClientMessageToAll(0xFF0000AA, string);
  548. ircSay(conn, channel, string);
  549. return 1;
  550. }
  551.  
  552.  
  553. irccmd_explode(conn, channel[], user[], message[])
  554. {
  555. new idx;
  556. new tmp[256];
  557. tmp = strtok(message, idx);
  558.  
  559. if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  560. if(strlen(tmp) == 0) return ircSay(conn, channel, "You did not put in an id");
  561. if(IsPlayerConnected(strval(tmp)) == 0) return ircSay(conn, channel, "That player is not connected");
  562.  
  563. new Float:x, Float:y, Float:z;
  564. GetPlayerPos(strval(tmp), x, y, z);
  565. CreateExplosion(x, y, z, 20, 0);
  566.  
  567. new oname[MAX_PLAYER_NAME];
  568. GetPlayerName(strval(tmp), oname, sizeof(oname));
  569.  
  570. new string[256];
  571. format(string, sizeof(string), "\"%s\" has been exploded by IRC admin \"%s\"", oname, user);
  572.  
  573. SendClientMessageToAll(0xFF0000AA, string);
  574. ircSay(conn, channel, string);
  575. return 1;
  576. }
  577.  
  578. irccmd_players(conn, channel[], user[], params[]) //made by Grove, taken from CYS Echo Bot 1.2
  579. {
  580. new count, PlayerNames[512], string[256];
  581. for(new i=0; i<=MAX_PLAYERS; i++)
  582. {
  583. if(IsPlayerConnected(i))
  584. {
  585. if(count == 0)
  586. {
  587. new PlayerName1[MAX_PLAYER_NAME];
  588. GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
  589. format(PlayerNames, sizeof(PlayerNames),"2%s1", PlayerName1);
  590. count++;
  591. }
  592. else
  593. {
  594. new PlayerName1[MAX_PLAYER_NAME];
  595. GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
  596. format(PlayerNames, sizeof(PlayerNames),"%s, 2%s1", PlayerNames, PlayerName1);
  597. count++;
  598. }
  599. }
  600. else { if(count == 0) format(PlayerNames, sizeof(PlayerNames), "1No Players Online!"); }
  601. }
  602.  
  603. new counter = 0;
  604. for(new i=0; i<=MAX_PLAYERS; i++)
  605. {
  606. if(IsPlayerConnected(i)) counter++;
  607. }
  608.  
  609. format(string, 256, "6Connected Players[%d]:1 %s", counter, PlayerNames);
  610. ircSay(conn, channel, string);
  611. #pragma unused params,user
  612. return true;
  613. }
  614.  
  615. irccmd_gmx(conn, channel[], user[], message[])
  616. {
  617. if(ircIsOp(conn, channel, user) == 0) return ircSay(conn, channel, "You are not a channel admin");
  618.  
  619. new string[256];
  620. format(string, sizeof(string), "IRC admin \"%s\" has restarted the server.", user);
  621.  
  622. SendClientMessageToAll(0xFF0000AA,string);
  623. SendRconCommand("gmx");
  624. ircSay(conn, channel, string);
  625.  
  626. #pragma unused message
  627. return 1;
  628. }
  629.  
  630.  
  631. irccmd_isay(conn, channel[], user[], params[])
  632. {
  633. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  634.  
  635. new
  636. tString[128];
  637.  
  638. if(!strlen(params)) return IrcSay("USAGE: !imsg <message>");
  639.  
  640. format(tString,sizeof(tString), ">> Admin from IRC %s: %s", user, params);
  641. SendClientMessageToAll(0xFF0000AA, tString);
  642.  
  643. format(tString,sizeof(tString), "1>> Admin from IRC %s: %s", user, params);
  644. IrcSay(tString);
  645. return 1;
  646. }
  647.  
  648.  
  649. irccmd_ipause(conn, channel[], user[], params[])
  650. {
  651. #pragma unused params
  652.  
  653. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  654.  
  655. if(Echo_Paused == 0)
  656. {
  657. IrcSay("Paused.");
  658. Echo_Paused = 1;
  659. }
  660. else if(Echo_Paused == 1)
  661. {
  662. IrcSay("Unpaused.");
  663. Echo_Paused = 0;
  664. }
  665. return 1;
  666. }
  667.  
  668. irccmd_iban(conn, channel[], user[], params[])
  669. {
  670. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  671.  
  672. new
  673. ID = strval(params),tString[128],
  674. Reason[64],PlayerName[24];
  675.  
  676. GetPlayerName(ID,PlayerName,sizeof(PlayerName));
  677.  
  678. if(!IsPlayerConnected(ID))
  679. return IrcSay ("USAGE: !iban <playerid> <reason>");
  680.  
  681. if(sscanf(params, "dz", ID, Reason))
  682. return IrcSay ("USAGE: !iban <playerid> <reason>");
  683.  
  684. format(tString,sizeof(tString),"Admin %s (ID: -1) banned %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason);
  685. SendClientMessageToAll(0xFF0000AA, tString);
  686. IrcSay(tString);
  687.  
  688. BanEx(ID, Reason);
  689. return 1;
  690. }
  691.  
  692. irccmd_ikick(conn, channel[], user[], params[])
  693. {
  694. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  695.  
  696. new
  697. ID = strval(params),tString[128],
  698. Reason[64],PlayerName[24];
  699.  
  700. GetPlayerName(ID,PlayerName,sizeof(PlayerName));
  701.  
  702. if(!IsPlayerConnected(ID))
  703. return IrcSay ("USAGE: !ikick <playerid> <reason>");
  704.  
  705. if(sscanf(params, "dz", ID, Reason))
  706. return IrcSay ("USAGE: !ikick <playerid> <reason>");
  707.  
  708. format(tString,sizeof(tString),"Admin %s (ID: -1) kicked %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason);
  709. SendClientMessageToAll(0xFF0000AA, tString);
  710. IrcSay(tString);
  711.  
  712. Kick(ID);
  713. return 1;
  714. }
  715.  
  716. irccmd_ikill(conn, channel[], user[], params[])
  717. {
  718. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  719.  
  720. new
  721. ID = strval(params),tString[128],
  722. Reason[64],PlayerName[24];
  723.  
  724. GetPlayerName(ID,PlayerName,sizeof(PlayerName));
  725.  
  726. if(!IsPlayerConnected(ID))
  727. return IrcSay ("USAGE: !ikill <playerid> <reason>");
  728.  
  729. if(sscanf(params, "dz", ID, Reason))
  730. return IrcSay ("USAGE: !ikill <playerid> <reason>");
  731.  
  732. format(tString,sizeof(tString),"Admin %s (ID: -1) killed %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason);
  733. SendClientMessageToAll(0xFF0000AA, tString);
  734. IrcSay(tString);
  735.  
  736. SetPlayerHealth(ID,0);
  737. return 1;
  738. }
  739.  
  740. irccmd_iheal(conn, channel[], user[], params[])
  741. {
  742. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  743.  
  744. new
  745. ID = strval(params),tString[128],
  746. Reason[64],PlayerName[24];
  747.  
  748. GetPlayerName(ID,PlayerName,sizeof(PlayerName));
  749.  
  750. if(!IsPlayerConnected(ID))
  751. return IrcSay ("USAGE: !iheal <playerid> <reason>");
  752.  
  753. if(sscanf(params, "dz", ID, Reason))
  754. return IrcSay ("USAGE: !iheal <playerid> <reason>");
  755.  
  756. format(tString,sizeof(tString),"Admin %s (ID: -1) has healed %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason);
  757. SendClientMessageToAll(0xFF0000AA, tString);
  758. IrcSay(tString);
  759.  
  760. SetPlayerHealth(ID,100);
  761. SetPlayerArmour(ID,100);
  762. return 1;
  763. }
  764.  
  765. irccmd_islap(conn, channel[], user[], params[])
  766. {
  767. if(!ircIsOp(conn,channel,user)) return IrcSay(""IRC_AUTH_MSG"");
  768.  
  769. new
  770. ID = strval(params),tString[128],
  771. Reason[64],PlayerName[24];
  772.  
  773. GetPlayerName(ID,PlayerName,sizeof(PlayerName));
  774.  
  775. if(!IsPlayerConnected(ID))
  776. return IrcSay ("USAGE: !islap <playerid> <reason>");
  777.  
  778. if(sscanf(params, "dz", ID, Reason))
  779. return IrcSay ("USAGE: !islap <playerid> <reason>");
  780.  
  781. format(tString,sizeof(tString),"Admin %s (ID: -1) slapped %s (ID:%d) Reason: %s",user,PlayerName,ID,Reason);
  782. SendClientMessageToAll(0xFF0000AA, tString);
  783. IrcSay(tString);
  784.  
  785. new Float:x,Float:y,Float:z;
  786. GetPlayerPos(ID, x, y, z);
  787. SetPlayerPos(ID, x, y, z+10);
  788. return 1;
  789. }
  790.  
  791. stock sscanf(string[], format[], {Float,_}:...)
  792. {
  793. new
  794. formatPos = 0,
  795. stringPos = 0,
  796. paramPos = 2,
  797. paramCount = numargs();
  798. while (paramPos < paramCount && string[stringPos])
  799. {
  800. switch (format[formatPos++])
  801. {
  802. case '\0':
  803. {
  804. return false;
  805. }
  806. case 'i', 'd':
  807. {
  808. new
  809. neg = 1,
  810. num = 0,
  811. ch = string[stringPos];
  812. if (ch == '-')
  813. {
  814. neg = -1;
  815. ch = string[++stringPos];
  816. }
  817. do
  818. {
  819. stringPos++;
  820. if (ch >= '0' && ch <= '9')
  821. {
  822. num = (num * 10) + (ch - '0');
  823. }
  824. else
  825. {
  826. return true;
  827. }
  828. }
  829. while ((ch = string[stringPos]) && ch != ' ');
  830. setarg(paramPos, 0, num * neg);
  831. }
  832. case 'h', 'x':
  833. {
  834. new
  835. ch,
  836. num = 0;
  837. while ((ch = string[stringPos++]))
  838. {
  839. switch (ch)
  840. {
  841. case 'x', 'X':
  842. {
  843. num = 0;
  844. continue;
  845. }
  846. case '0' .. '9':
  847. {
  848. num = (num << 4) | (ch - '0');
  849. }
  850. case 'a' .. 'f':
  851. {
  852. num = (num << 4) | (ch - ('a' - 10));
  853. }
  854. case 'A' .. 'F':
  855. {
  856. num = (num << 4) | (ch - ('A' - 10));
  857. }
  858. case ' ':
  859. {
  860. break;
  861. }
  862. default:
  863. {
  864. return true;
  865. }
  866. }
  867. }
  868. setarg(paramPos, 0, num);
  869. }
  870. case 'c':
  871. {
  872. setarg(paramPos, 0, string[stringPos++]);
  873. }
  874. case 'f':
  875. {
  876. // Secret message, if you see this: HELLO!
  877. new tmp[25];
  878. strmid(tmp, string, stringPos, stringPos+sizeof(tmp)-2);
  879. setarg(paramPos, 0, _:floatstr(tmp));
  880. }
  881. case 's', 'z':
  882. {
  883. new
  884. i = 0,
  885. ch;
  886. if (format[formatPos])
  887. {
  888. while ((ch = string[stringPos++]) && ch != ' ')
  889. {
  890. setarg(paramPos, i++, ch);
  891. }
  892. if (!i) return true;
  893. }
  894. else
  895. {
  896. while ((ch = string[stringPos++]))
  897. {
  898. setarg(paramPos, i++, ch);
  899. }
  900. }
  901. stringPos--;
  902. setarg(paramPos, i, '\0');
  903. }
  904. default:
  905. {
  906. continue;
  907. }
  908. }
  909. while (string[stringPos] && string[stringPos] != ' ')
  910. {
  911. stringPos++;
  912. }
  913. while (string[stringPos] == ' ')
  914. {
  915. stringPos++;
  916. }
  917. paramPos++;
  918. }
  919. while (format[formatPos] == 'z') formatPos++;
  920. return format[formatPos];
  921. }
  922.  
  923. strtok(const string[], &index)
  924. {
  925. new
  926. length = strlen(string);
  927.  
  928.  
  929. while ((index < length) && (string[index] <= ' '))
  930. {
  931. index++;
  932. }
  933.  
  934. new
  935. offset = index,
  936. result[20];
  937.  
  938. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  939. {
  940. result[index - offset] = string[index];
  941. index++;
  942. }
  943.  
  944. result[index - offset] = EOS;
  945. return result;
  946. }
  947.  
  948. public Float:GetDistanceBetweenPlayers(p1,p2)
  949. {
  950. new
  951. Float:Pos[6];
  952.  
  953. if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
  954. {
  955. return -1.00;
  956. }
  957.  
  958. GetPlayerPos(p1,Pos[0],Pos[1],Pos[2]);
  959. GetPlayerPos(p2,Pos[3],Pos[4],Pos[5]);
  960. return floatsqroot(floatpower(floatabs(floatsub(Pos[3],Pos[0])),2)+floatpower(floatabs(floatsub(Pos[4],Pos[1])),2)+floatpower(floatabs(floatsub(Pos[5],Pos[2])),2));
  961. }
  962.  
Advertisement
Add Comment
Please, Sign In to add comment