Advertisement
Guest User

Untitled

a guest
Oct 19th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.14 KB | None | 0 0
  1. // Porsche911's IRC PAWN Script!
  2.  
  3. #include <a_samp>
  4. #include <irc>
  5.  
  6. // Name that everyone will see
  7. #define BOT_1_NICKNAME "BotA"
  8. // Name that will only be visible in a whois
  9. #define BOT_1_REALNAME "SA-MP Bot"
  10. // Name that will be in front of the hostname (username@hostname)
  11. #define BOT_1_USERNAME "bot"
  12.  
  13. #define BOT_2_NICKNAME "BotB"
  14. #define BOT_2_REALNAME "SA-MP Bot"
  15. #define BOT_2_USERNAME "bot"
  16.  
  17. #define IRC_SERVER "irc.foco.co" // EDIT IT to your irc server
  18. #define IRC_PORT (6667) // Leave THE port
  19. #define IRC_CHANNEL "#Samp4Ever" // Set it to your IRC Channel!
  20. #define blue 0x375FFFFF
  21. #define red 0xFF0000AA
  22. #define green 0x33FF33AA
  23. #define ROJO 0x33FF33AA
  24. #define yellow 0xFFFF00AA
  25. #define grey 0xC0C0C0AA
  26. #define blue1 0x2641FEAA
  27. #define lightblue 0x33CCFFAA
  28. #define orange 0xFF9900AA
  29. #define black 0x2C2727AA
  30.  
  31.  
  32. #pragma tabsize 0
  33.  
  34. // Maximum number of bots in the filterscript
  35. #define MAX_BOTS (2)
  36.  
  37. new
  38. gBotID[MAX_BOTS],
  39. gGroupID;
  40.  
  41. /*
  42. When the filterscript is loaded, two bots will connect and a group will be
  43. created for them.
  44. */
  45.  
  46. public
  47. OnFilterScriptInit()
  48. {
  49. // Wait 5 seconds for the first bot
  50. SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);
  51. // Wait 10 seconds for the second bot
  52. SetTimerEx("IRC_ConnectDelay", 10000, 0, "d", 2);
  53. // Create a group (the bots will be added to it upon connect)
  54. gGroupID = IRC_CreateGroup();
  55. }
  56.  
  57. /*
  58. When the filterscript is unloaded, the bots will disconnect, and the group
  59. will be destroyed.
  60. */
  61.  
  62. public
  63. OnFilterScriptExit()
  64. {
  65. // Disconnect the first bot
  66. IRC_Quit(gBotID[0], "Filterscript exiting");
  67. // Disconnect the second bot
  68. IRC_Quit(gBotID[1], "Filterscript exiting");
  69. // Destroy the group
  70. IRC_DestroyGroup(gGroupID);
  71. }
  72.  
  73. /*
  74. This function is called on a timer in order to delay connections to the IRC
  75. server and effectively prevent join floods.
  76. */
  77.  
  78. forward
  79. IRC_ConnectDelay(tempid);
  80.  
  81. public
  82. IRC_ConnectDelay(tempid)
  83. {
  84. switch (tempid)
  85. {
  86. case 1:
  87. {
  88. // Connect the first bot
  89. gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  90. }
  91. case 2:
  92. {
  93. // Connect the second bot
  94. gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
  95. }
  96. }
  97. return 1;
  98. }
  99.  
  100. /*
  101. The standard SA-MP callbacks are below. We will echo a few of them to the
  102. IRC channel.
  103. */
  104.  
  105. public
  106. OnPlayerConnect(playerid)
  107. {
  108. new
  109. joinMsg[128],
  110. name[MAX_PLAYER_NAME];
  111. GetPlayerName(playerid, name, sizeof(name));
  112. format(joinMsg, sizeof(joinMsg), "02[%d] 03*** %s has joined the server.", playerid, name);
  113. IRC_GroupSay(gGroupID, IRC_CHANNEL, joinMsg);
  114. return 1;
  115. }
  116.  
  117. public
  118. OnPlayerDisconnect(playerid, reason)
  119. {
  120. new
  121. leaveMsg[128],
  122. name[MAX_PLAYER_NAME],
  123. reasonMsg[8];
  124. switch(reason)
  125. {
  126. case 0:
  127. {
  128. reasonMsg = "Timeout";
  129. }
  130. case 1:
  131. {
  132. reasonMsg = "Leaving";
  133. }
  134. case 2:
  135. {
  136. reasonMsg = "Kicked";
  137. }
  138. }
  139. GetPlayerName(playerid, name, sizeof(name));
  140. format(leaveMsg, sizeof(leaveMsg), "02[%d] 03*** %s has left the server. (%s)", playerid, name, reasonMsg);
  141. IRC_GroupSay(gGroupID, IRC_CHANNEL, leaveMsg);
  142. return 1;
  143. }
  144.  
  145. /*
  146. Here is an extensive list of death reasons that I compiled some time ago. It
  147. correctly reports all types of kills, including those made in some vehicles.
  148. */
  149.  
  150. public
  151. OnPlayerDeath(playerid, killerid, reason)
  152. {
  153. new
  154. msg[128],
  155. killerName[MAX_PLAYER_NAME],
  156. reasonMsg[32],
  157. playerName[MAX_PLAYER_NAME];
  158. GetPlayerName(killerid, killerName, sizeof(killerName));
  159. GetPlayerName(playerid, playerName, sizeof(playerName));
  160. if (killerid != INVALID_PLAYER_ID)
  161. {
  162. switch (reason)
  163. {
  164. case 0:
  165. {
  166. reasonMsg = "Unarmed";
  167. }
  168. case 1:
  169. {
  170. reasonMsg = "Brass Knuckles";
  171. }
  172. case 2:
  173. {
  174. reasonMsg = "Golf Club";
  175. }
  176. case 3:
  177. {
  178. reasonMsg = "Night Stick";
  179. }
  180. case 4:
  181. {
  182. reasonMsg = "Knife";
  183. }
  184. case 5:
  185. {
  186. reasonMsg = "Baseball Bat";
  187. }
  188. case 6:
  189. {
  190. reasonMsg = "Shovel";
  191. }
  192. case 7:
  193. {
  194. reasonMsg = "Pool Cue";
  195. }
  196. case 8:
  197. {
  198. reasonMsg = "Katana";
  199. }
  200. case 9:
  201. {
  202. reasonMsg = "Chainsaw";
  203. }
  204. case 10:
  205. {
  206. reasonMsg = "Dildo";
  207. }
  208. case 11:
  209. {
  210. reasonMsg = "Dildo";
  211. }
  212. case 12:
  213. {
  214. reasonMsg = "Vibrator";
  215. }
  216. case 13:
  217. {
  218. reasonMsg = "Vibrator";
  219. }
  220. case 14:
  221. {
  222. reasonMsg = "Flowers";
  223. }
  224. case 15:
  225. {
  226. reasonMsg = "Cane";
  227. }
  228. case 22:
  229. {
  230. reasonMsg = "Pistol";
  231. }
  232. case 23:
  233. {
  234. reasonMsg = "Silenced Pistol";
  235. }
  236. case 24:
  237. {
  238. reasonMsg = "Desert Eagle";
  239. }
  240. case 25:
  241. {
  242. reasonMsg = "Shotgun";
  243. }
  244. case 26:
  245. {
  246. reasonMsg = "Sawn-off Shotgun";
  247. }
  248. case 27:
  249. {
  250. reasonMsg = "Combat Shotgun";
  251. }
  252. case 28:
  253. {
  254. reasonMsg = "MAC-10";
  255. }
  256. case 29:
  257. {
  258. reasonMsg = "MP5";
  259. }
  260. case 30:
  261. {
  262. reasonMsg = "AK-47";
  263. }
  264. case 31:
  265. {
  266. if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  267. {
  268. switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
  269. {
  270. case 447:
  271. {
  272. reasonMsg = "Sea Sparrow Machine Gun";
  273. }
  274. default:
  275. {
  276. reasonMsg = "M4";
  277. }
  278. }
  279. }
  280. else
  281. {
  282. reasonMsg = "M4";
  283. }
  284. }
  285. case 32:
  286. {
  287. reasonMsg = "TEC-9";
  288. }
  289. case 33:
  290. {
  291. reasonMsg = "Rifle";
  292. }
  293. case 34:
  294. {
  295. reasonMsg = "Sniper Rifle";
  296. }
  297. case 37:
  298. {
  299. reasonMsg = "Fire";
  300. }
  301. case 38:
  302. {
  303. if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  304. {
  305. switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
  306. {
  307. case 425:
  308. {
  309. reasonMsg = "Hunter Machine Gun";
  310. }
  311. default:
  312. {
  313. reasonMsg = "Minigun";
  314. }
  315. }
  316. }
  317. else
  318. {
  319. reasonMsg = "Minigun";
  320. }
  321. }
  322. case 41:
  323. {
  324. reasonMsg = "Spraycan";
  325. }
  326. case 42:
  327. {
  328. reasonMsg = "Fire Extinguisher";
  329. }
  330. case 49:
  331. {
  332. reasonMsg = "Vehicle Collision";
  333. }
  334. case 50:
  335. {
  336. if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  337. {
  338. switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
  339. {
  340. case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563:
  341. {
  342. reasonMsg = "Helicopter Blades";
  343. }
  344. default:
  345. {
  346. reasonMsg = "Vehicle Collision";
  347. }
  348. }
  349. }
  350. else
  351. {
  352. reasonMsg = "Vehicle Collision";
  353. }
  354. }
  355. case 51:
  356. {
  357. if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
  358. {
  359. switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
  360. {
  361. case 425:
  362. {
  363. reasonMsg = "Hunter Rockets";
  364. }
  365. case 432:
  366. {
  367. reasonMsg = "Rhino Turret";
  368. }
  369. case 520:
  370. {
  371. reasonMsg = "Hydra Rockets";
  372. }
  373. default:
  374. {
  375. reasonMsg = "Explosion";
  376. }
  377. }
  378. }
  379. else
  380. {
  381. reasonMsg = "Explosion";
  382. }
  383. }
  384. default:
  385. {
  386. reasonMsg = "Unknown";
  387. }
  388. }
  389. format(msg, sizeof(msg), "04*** %s killed %s. (%s)", killerName, playerName, reasonMsg);
  390. }
  391. else
  392. {
  393. switch (reason)
  394. {
  395. case 53:
  396. {
  397. format(msg, sizeof(msg), "04*** %s died. (Drowned)", playerName);
  398. }
  399. case 54:
  400. {
  401. format(msg, sizeof(msg), "04*** %s died. (Collision)", playerName);
  402. }
  403. default:
  404. {
  405. format(msg, sizeof(msg), "04*** %s died.", playerName);
  406. }
  407. }
  408. }
  409. IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
  410. return 1;
  411. }
  412.  
  413. public
  414. OnPlayerText(playerid, text[])
  415. {
  416. new
  417. name[MAX_PLAYER_NAME],
  418. ircMsg[256];
  419. GetPlayerName(playerid, name, sizeof(name));
  420. format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, name, text);
  421. IRC_GroupSay(gGroupID, IRC_CHANNEL, ircMsg);
  422. return 1;
  423. }
  424.  
  425. /*
  426. The IRC callbacks are below. Many of these are simply derived from parsed
  427. raw messages received from the IRC server. They can be used to inform the
  428. bot of new activity in any of the channels it has joined.
  429. */
  430.  
  431. public
  432. IRC_OnConnect(botid)
  433. {
  434. printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
  435. // Join the channel
  436. IRC_JoinChannel(botid, IRC_CHANNEL);
  437. // Add the bot to the group
  438. IRC_AddToGroup(gGroupID, botid);
  439. return 1;
  440. }
  441.  
  442. /*
  443. Note that this callback is executed whenever a current connection is closed
  444. OR whenever a connection attempt fails. Reconnecting too fast can flood the
  445. IRC server and possibly result in a ban. It is recommended to set up
  446. connection reattempts on a timer, as demonstrated here.
  447. */
  448.  
  449. public
  450. IRC_OnDisconnect(botid)
  451. {
  452. printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
  453. if (botid == gBotID[0])
  454. {
  455. // Reset the bot ID
  456. gBotID[0] = 0;
  457. // Wait 20 seconds for the first bot
  458. SetTimerEx("IRC_ConnectDelay", 20000, 0, "d", 1);
  459. }
  460. else if (botid == gBotID[1])
  461. {
  462. // Reset the bot ID
  463. gBotID[1] = 0;
  464. // Wait 25 seconds for the second bot
  465. SetTimerEx("IRC_ConnectDelay", 25000, 0, "d", 2);
  466. }
  467. printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
  468. // Remove the bot from the group
  469. IRC_RemoveFromGroup(gGroupID, botid);
  470. return 1;
  471. }
  472.  
  473. public
  474. IRC_OnJoinChannel(botid, channel[])
  475. {
  476. printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
  477. return 1;
  478. }
  479.  
  480. /*
  481. If the bot cannot immediately rejoin the channel (in the event, for example,
  482. that the bot is kicked and then banned), you might want to set up a timer
  483. here as well for rejoin attempts.
  484. */
  485.  
  486. public
  487. IRC_OnLeaveChannel(botid, channel[], message[])
  488. {
  489. printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)!", botid, channel, message);
  490. IRC_JoinChannel(botid, channel);
  491. return 1;
  492. }
  493.  
  494. public
  495. IRC_OnUserDisconnect(botid, user[], host[], message[])
  496. {
  497. printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected! (%s)", botid, user, host, message);
  498. return 1;
  499. }
  500.  
  501. public
  502. IRC_OnUserJoinChannel(botid, channel[], user[], host[])
  503. {
  504. printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s!", botid, user, host, channel);
  505. return 1;
  506. }
  507.  
  508. public
  509. IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
  510. {
  511. printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)!", botid, user, host, channel, message);
  512. return 1;
  513. }
  514.  
  515. public
  516. IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
  517. {
  518. printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his nick to %s!", botid, oldnick, host, newnick);
  519. return 1;
  520. }
  521.  
  522. public
  523. IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
  524. {
  525. printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s!", botid, user, host, channel, mode);
  526. return 1;
  527. }
  528.  
  529. public
  530. IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
  531. {
  532. printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s!", botid, user, host, channel, topic);
  533. return 1;
  534. }
  535.  
  536. public
  537. IRC_OnUserSay(botid, recipient[], user[], host[], message[])
  538. {
  539. printf("*** IRC_OnUserSay (Bot ID %d): User %s (%s) sent message to %s: %s", botid, user, host, recipient, message);
  540. // Someone sent the first bot a private message
  541. if (!strcmp(recipient, BOT_1_NICKNAME))
  542. {
  543. IRC_Say(botid, user, "You sent me a PM!");
  544. }
  545. return 1;
  546. }
  547.  
  548. public
  549. IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
  550. {
  551. printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
  552. // Someone sent the second bot a notice (probably a network service)
  553. if (!strcmp(recipient, BOT_2_NICKNAME))
  554. {
  555. IRC_Notice(botid, user, "You sent me a notice!");
  556. }
  557. return 1;
  558. }
  559.  
  560. /*
  561. This callback is useful for logging, debugging, or catching error messages
  562. sent by the IRC server.
  563. */
  564.  
  565. public
  566. IRC_OnReceiveRaw(botid, message[])
  567. {
  568. new
  569. File:file;
  570. if (!fexist("irc_log.txt"))
  571. {
  572. file = fopen("irc_log.txt", io_write);
  573. }
  574. else
  575. {
  576. file = fopen("irc_log.txt", io_append);
  577. }
  578. if (file)
  579. {
  580. fwrite(file, message);
  581. fwrite(file, "\r\n");
  582. fclose(file);
  583. }
  584. return 1;
  585. }
  586.  
  587. /*
  588. Some examples of channel commands are here. You can add more very easily;
  589. their implementation is identical to that of ZeeX's zcmd.
  590. */
  591.  
  592. IRCCMD:say(botid, channel[], user[], host[], params[])
  593. {
  594. // Check if the user has at least voice in the channel
  595. if (IRC_IsVoice(botid, channel, user))
  596. {
  597. // Check if the user entered any text
  598. if (!isnull(params))
  599. {
  600. new
  601. msg[128];
  602. // Echo the formatted message
  603. format(msg, sizeof(msg), "02*** %s on IRC: %s", user, params);
  604. IRC_GroupSay(gGroupID, channel, msg);
  605. format(msg, sizeof(msg), "*** %s on IRC: %s", user, params);
  606. SendClientMessageToAll(0x0000FFFF, msg);
  607. }
  608. }
  609. return 1;
  610. }
  611.  
  612. IRCCMD:kick(botid, channel[], user[], host[], params[])
  613. {
  614. // Check if the user is at least a halfop in the channel
  615. if (IRC_IsHalfop(botid, channel, user))
  616. {
  617. new
  618. playerid,
  619. reason[64];
  620. // If the user did not enter a player ID, then the command will not be processed
  621. if (sscanf(params, "dz", playerid, reason))
  622. {
  623. return 1;
  624. }
  625. // If the player is not connected, then nothing will be done
  626. if (IsPlayerConnected(playerid))
  627. {
  628. new
  629. msg[128],
  630. name[MAX_PLAYER_NAME];
  631. // If no reason is given, then "No reason" will be stated
  632. if (isnull(reason))
  633. {
  634. format(reason, sizeof(reason), "No reason");
  635. }
  636. // Echo the formatted message and kick the user
  637. GetPlayerName(playerid, name, sizeof(name));
  638. format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
  639. IRC_GroupSay(gGroupID, channel, msg);
  640. format(msg, sizeof(msg), "*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
  641. SendClientMessageToAll(0x0000FFFF, msg);
  642. Kick(playerid);
  643. }
  644. }
  645. return 1;
  646. }
  647.  
  648. IRCCMD:ban(botid, channel[], user[], host[], params[])
  649. {
  650. // Check if the user is at least an op in the channel
  651. if (IRC_IsOp(botid, channel, user))
  652. {
  653. new
  654. playerid,
  655. reason[64];
  656. // If the user did not enter a player ID, then the command will not be processed
  657. if (sscanf(params, "dz", playerid, reason))
  658. {
  659. return 1;
  660. }
  661. // If the player is not connected, then nothing will be done
  662. if (IsPlayerConnected(playerid))
  663. {
  664. new
  665. msg[128],
  666. name[MAX_PLAYER_NAME];
  667. // If no reason is given, then "No reason" will be stated
  668. if (isnull(reason))
  669. {
  670. format(reason, sizeof(reason), "No reason");
  671. }
  672. // Echo the formatted message and ban the user
  673. GetPlayerName(playerid, name, sizeof(name));
  674. format(msg, sizeof(msg), "02*** %s has been banned by %s on IRC. (%s)", name, user, reason);
  675. IRC_GroupSay(gGroupID, channel, msg);
  676. format(msg, sizeof(msg), "*** %s has been banned by %s on IRC. (%s)", name, user, reason);
  677. SendClientMessageToAll(0x0000FFFF, msg);
  678. BanEx(playerid, reason);
  679. }
  680. }
  681. return 1;
  682. }
  683.  
  684. IRCCMD:rcon(botid, channel[], user[], host[], params[])
  685. {
  686. // Check if the user is at least an op in the channel
  687. if (IRC_IsOp(botid, channel, user))
  688. {
  689. // Check if the user entered any text
  690. if (!isnull(params))
  691. {
  692. // Check if the user did not enter any bad commands
  693. if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
  694. {
  695. // Echo the formatted message and send the command
  696. new
  697. msg[128];
  698. format(msg, sizeof(msg), "RCON command %s has been executed.", params);
  699. IRC_GroupSay(gGroupID, channel, msg);
  700. SendRconCommand(params);
  701. }
  702. }
  703. }
  704. return 1;
  705. }
  706.  
  707. IRCCMD:text(botid, channel[], user[], host[], params[])
  708. {
  709. // Check if the user has at least operator in the channel
  710. if (IRC_IsOp(botid, IRC_CHANNEL, user))
  711. {
  712. // Check if the user entered any text
  713. if (!isnull(params))
  714. {
  715. new
  716. msg[128];
  717. // Echo the formatted message
  718. format(msg, sizeof(msg), " %s You have succesfully Send This Text: %s", user, params);
  719. IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
  720. format(msg, sizeof(msg), "%s", params);
  721. SendClientMessageToAll(0xFFFF00AA, msg);
  722. }
  723. }
  724. return 1;
  725. }
  726.  
  727. IRCCMD:admin(botid, channel[], user[], host[], params[])
  728. {
  729. // Check if the user has at least operator in the channel
  730. if (IRC_IsOp(botid, IRC_CHANNEL, user))
  731. {
  732. // Check if the user entered any text
  733. if (!isnull(params))
  734. {
  735. new
  736. msg[128];
  737. // Echo the formatted message
  738. format(msg, sizeof(msg), " %s You Send This Admin Text Message: %s", user, params);
  739. IRC_GroupSay(botid, IRC_CHANNEL, msg);
  740. format(msg, sizeof(msg), "Admin: %s", params);
  741. SendClientMessageToAll(0xFFFF00AA, msg);
  742. }
  743. }
  744. return 1;
  745. }
  746.  
  747.  
  748.  
  749. IRCCMD:crash(botid, channel[], user[], host[], params[])
  750. {
  751. if (IRC_IsAdmin(botid, channel, user))
  752. {
  753. new
  754. playerid;
  755. if (sscanf(params, "d", playerid))
  756. {
  757. return 1;
  758. }
  759. if (IsPlayerConnected(playerid))
  760. {
  761. new
  762. msg[128],
  763. name[MAX_PLAYER_NAME];
  764. GetPlayerName(playerid, name, sizeof(name));
  765. format(msg, sizeof(msg), "*** %s Has Crashed %s.", user, name);
  766. IRC_GroupSay(gGroupID, channel, msg);
  767. Crash(playerid);
  768. }
  769. }
  770. return 1;
  771. }
  772. IRCCMD:quarantine(botid, channel[], user[], host[], params[])
  773. {
  774.  
  775. // Check if the user is at least an op in the channel
  776. if (IRC_IsOwner(botid, channel, user))
  777. {
  778. new
  779. playerid,
  780. reason[64];
  781. // If the user did not enter a player ID, then the command will not be processed
  782. if (sscanf(params, "ds", playerid, reason))
  783. {
  784. return 1;
  785. }
  786. // If the player is not connected, then nothing will be done
  787. if (IsPlayerConnected(playerid))
  788. {
  789. new
  790. msg[128],
  791. name[MAX_PLAYER_NAME];
  792. // Echo the formatted message and ban the user
  793. GetPlayerName(playerid, name, sizeof(name));
  794. format(msg, sizeof(msg), "02*** %s has put %s in quarantine from IRC.", user, name);
  795. IRC_GroupSay(gGroupID, channel, msg);
  796. format(msg, sizeof(msg), "* Admin %s on IRC has put %s in quarantine.", user, name);
  797. SendClientMessage(playerid, 0x9D000096, msg);
  798. SetPlayerPos(playerid,-221.059051,1408.984008,27.773437);
  799. SetPlayerInterior(playerid,18);
  800. SetPlayerVirtualWorld(playerid,0);
  801. TogglePlayerControllable(playerid,0);
  802. }
  803. }
  804. return 1;
  805. }
  806.  
  807. IRCCMD:sethp(botid, channel[], user[], host[], params[])
  808. {
  809.  
  810. new string[128], ID, health;
  811. if(sscanf(params, "is", ID, health))
  812. return IRC_Say(gGroupID, channel, "Use: !sethealth [ID] [HEALTH]");
  813.  
  814. if(IRC_IsOp(botid, channel, user))
  815. if(!IsPlayerConnected(ID))
  816. return IRC_Say(gGroupID,channel,"4*** Error: Invalid player ID.");
  817.  
  818. SetPlayerHealth(ID, health);
  819.  
  820. new oname[MAX_PLAYER_NAME];
  821. GetPlayerName(ID, oname, sizeof(oname));
  822.  
  823. format(string, sizeof(string), "%s has had thier health set to %.0f by IRC admin %s", oname, health, user);
  824. IRC_Say(gGroupID,channel,string);
  825. return 1;
  826. }
  827.  
  828.  
  829. IRCCMD:giveweapon(botid, channel[], user[], host, params[])
  830. {
  831. new string[128],
  832. ID,
  833. weapid,
  834. ammo;
  835.  
  836. if(sscanf(params, "iii", ID, weapid, ammo))
  837. return IRC_Say(gGroupID, channel, "Use: !giveweapon [ID] [WEPID] [AMMO]");
  838.  
  839. if(IRC_IsAdmin(botid, channel, user))
  840. if(!IsPlayerConnected(ID))
  841. return IRC_Say(gGroupID, channel,"4*** Error: Invalid player ID.");
  842. GivePlayerWeapon(ID, weapid, ammo);
  843. new oname[MAX_PLAYER_NAME];
  844. GetPlayerName(ID, oname, sizeof(oname));
  845. new weapname[24];
  846. GetWeaponName(weapid, weapname, 32);
  847. format(string, sizeof(string), "%s has been given a %d with %d ammo by IRC admin %s", oname, weapname, ammo, user);
  848. SendClientMessageToAll(red, string);
  849. IRC_Say(gGroupID,channel,string);
  850. return 1;
  851. }
  852.  
  853. IRCCMD:score(botid, channel[], user[], host[], params[])
  854. {
  855.  
  856. new giveid,msg1[256];
  857. if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !score <PlayerName/PlayerID>");
  858. giveid = ReturnUser(params);
  859. if(!IsPlayerConnected(giveid))return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  860. format(msg1,256,"10>> Score from %s (ID:%d): %d",PlayerName(giveid),giveid,GetPlayerScore(giveid));
  861. IRC_GroupSay(gGroupID,channel,msg1);
  862. return 1;
  863. }
  864.  
  865. IRCCMD:slap(botid, channel[], user[], host[], params[])
  866. {
  867.  
  868. if (IRC_IsOp(botid, channel, user))
  869. {
  870. new
  871. playerid,
  872. reason[64];
  873. new Float:pX,Float:pY,Float:pZ;
  874. new Float:health;
  875.  
  876. if (sscanf(params, "ds[64]", playerid, reason))
  877. {
  878. return 1;
  879. }
  880.  
  881. if (IsPlayerConnected(playerid))
  882. {
  883. new
  884. msg[128],
  885. name[MAX_PLAYER_NAME];
  886.  
  887. if (isnull(reason))
  888. {
  889. format(reason, sizeof(reason), "<no reason defined>");
  890. }
  891.  
  892. GetPlayerName(playerid, name, sizeof(name));
  893. GetPlayerPos(playerid,pX,pY,pZ);
  894. GetPlayerHealth(playerid,health);
  895. SetPlayerHealth(playerid,health-15);
  896. SetPlayerPos(playerid,pX,pY,pZ+15);
  897. GetPlayerHealth(playerid,health);
  898. format(msg, sizeof(msg), "02 %s has slapped by %s on IRC for %s - %.0f health left!", name, user, reason, health);
  899. IRC_GroupSay(gGroupID, channel, msg);
  900.  
  901.  
  902.  
  903. }
  904. }
  905. return 1;
  906. }
  907.  
  908.  
  909.  
  910. IRCCMD:osay(botid, channel[], user[], host[], params[])
  911. {
  912. if (IRC_IsOwner(botid, channel, user))
  913. {
  914. if (!isnull(params))
  915. {
  916. new
  917. msg[128];
  918. format(msg, sizeof(msg), "0*** Owner on IRC: %s",params);
  919. IRC_GroupSay(gGroupID, channel, msg);
  920. format(msg, sizeof(msg), "*** Owner on IRC: %s",params);
  921. SendClientMessageToAll(0xFFFFFFAA, msg);
  922. }
  923. }
  924. return 1;
  925. }
  926.  
  927. IRCCMD:asay(botid, channel[], user[], host[], params[])
  928. {
  929. if (IRC_IsOp(botid, channel, user))
  930. {
  931. if (!isnull(params))
  932. {
  933. new
  934. msg[128];
  935. format(msg, sizeof(msg), "0*** Admin on IRC: %s",params);
  936. IRC_GroupSay(gGroupID, channel, msg);
  937. format(msg, sizeof(msg), "*** Admin on IRC: %s",params);
  938. SendClientMessageToAll(0xFFFFFFAA, msg);
  939. }
  940. }
  941. return 1;
  942. }
  943.  
  944. IRCCMD:freeze(botid, channel[], user[], host[], params[])
  945. {
  946. if(IRC_IsHalfop(botid, channel, user))
  947. {
  948. new
  949. playerid,
  950. reason[64];
  951. if (sscanf(params, "ds[64]", playerid, reason))
  952. {
  953. return 1;
  954. }
  955. if (IsPlayerConnected(playerid))
  956. {
  957. new
  958. msg[128],
  959. name[MAX_PLAYER_NAME];
  960. if (isnull(reason))
  961. {
  962. format(reason, sizeof(reason), "no reason (Abuse?)");
  963. }
  964. GetPlayerName(playerid, name, sizeof(name));
  965. format(msg, sizeof(msg), "02*** %s has been frozen by %s on IRC. (%s)", name, user, reason);
  966. IRC_GroupSay(gGroupID, channel, msg);
  967. TogglePlayerControllable(playerid,0);
  968. }
  969. }
  970.  
  971. return 1;
  972. }
  973.  
  974. IRCCMD:unfreeze(botid, channel[], user[], host[], params[])
  975. {
  976. if (IRC_IsHalfop(botid, channel, user))
  977. {
  978. new
  979. playerid,
  980. reason[64];
  981. if (sscanf(params, "ds[64]", playerid, reason))
  982. {
  983. return 1;
  984. }
  985. if (IsPlayerConnected(playerid))
  986. {
  987. new
  988. msg[128],
  989. name[MAX_PLAYER_NAME];
  990. if (isnull(reason))
  991. {
  992. format(reason, sizeof(reason), "No Reason");
  993. }
  994. GetPlayerName(playerid, name, sizeof(name));
  995. format(msg, sizeof(msg), "02*** %s has been unfrozen by %s on IRC.", name, user);
  996. IRC_GroupSay(gGroupID, channel, msg);
  997. TogglePlayerControllable(playerid,1);
  998. }
  999. }
  1000. return 1;
  1001. }
  1002.  
  1003.  
  1004. IRCCMD:gmx(botid, channel[], user[], host[], params[])
  1005. {
  1006. if (IRC_IsAdmin(botid, channel, user))
  1007. {
  1008. new
  1009. msg[128];
  1010. format(msg, sizeof(msg), "The server was restarted by Admin %s.", user);
  1011. IRC_GroupSay(gGroupID, channel, msg);
  1012. SendRconCommand("gmx");
  1013. SendClientMessageToAll(0xFF0000FF, msg);
  1014. }
  1015. return 1;
  1016. }
  1017.  
  1018.  
  1019.  
  1020. IRCCMD:unbanip(botid, channel[], user[], host[], params[])
  1021. {
  1022. new IP[256],msg1[256],msg2[256],Reason[256],msg[100];
  1023. if(IRC_IsAdmin(botid, channel, user))
  1024. if(sscanf(params, "sz",IP,Reason))
  1025. return IRC_GroupSay(gGroupID,channel,"3Usage: !unbanip <IP> <Reason [Optional]>");
  1026. if(!IsStringIP(IP))
  1027. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid IP.");
  1028. if(!strlen(Reason)) {
  1029. format(msg1,sizeof(msg1),"4*** %s (IRC) unbanned the ip %s",user,IP);
  1030. format(msg2,sizeof(msg2),"*** %s (IRC) unbanned the ip %s",user,IP);
  1031. }
  1032. else {
  1033. format(msg1,sizeof(msg1),"4*** %s (IRC) unbanned the ip %s, reason: %s.",user,IP,Reason);
  1034. format(msg2,sizeof(msg2),"*** %s (IRC) unbanned the ip %s, reason: %s.",user,IP,Reason);
  1035. }
  1036. IRC_GroupSay(gGroupID,channel,msg1);
  1037. format(msg,256,"unbanip %s",IP);
  1038. SendRconCommand(msg);
  1039. SendRconCommand("reloadbans");
  1040. return 1;
  1041. }
  1042.  
  1043. IRCCMD:banip(botid, channel[], user[], host[], params[])
  1044. {
  1045. new IP[256],msg1[256],msg2[256],Reason[256],msg[100];
  1046.  
  1047. if(IRC_IsOp(botid, channel, user))
  1048. if(sscanf(params, "sz",IP,Reason)) return IRC_GroupSay(gGroupID,channel,"3Usage: !banip <IP> <Reason [Optional]>");
  1049. if(!IsStringIP(IP)) return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid IP.");
  1050. if(!strlen(Reason)) {
  1051. format(msg1,sizeof(msg1),"4*** %s (IRC) banned the ip %s",user,IP);
  1052. format(msg2,sizeof(msg2),"*** %s (IRC) banned the ip %s",user,IP);
  1053. }
  1054. else {
  1055. format(msg1,sizeof(msg1),"4*** %s (IRC) banned the ip %s, reason: %s.",user,IP,Reason);
  1056. format(msg2,sizeof(msg2),"*** %s (IRC) banned the ip %s, reason: %s.",user,IP,Reason);
  1057. }
  1058. IRC_GroupSay(gGroupID,channel,msg1);
  1059. format(msg,256,"banip %s",IP);
  1060. SendRconCommand(msg);
  1061. return 1;
  1062. }
  1063.  
  1064. IRCCMD:explode(botid, channel[], user[], host[], params[])
  1065. {
  1066. new string[128],
  1067. ID;
  1068. if(sscanf(params, "i", ID))
  1069. return IRC_GroupSay(gGroupID, channel, "Use: !explode [ID]");
  1070. if(IRC_IsOp(botid, channel, user))
  1071. if(!IsPlayerConnected(ID))
  1072. return IRC_GroupSay(gGroupID, channel,"4*** Error: Invalid player ID.");
  1073.  
  1074. new Float:x, Float:y, Float:z;
  1075. GetPlayerPos(ID, x, y, z);
  1076. CreateExplosion(x, y, z, 10, 0);
  1077.  
  1078. new oname[MAX_PLAYER_NAME];
  1079. GetPlayerName(ID, oname, sizeof(oname));
  1080.  
  1081. format(string, sizeof(string), "%s has been nuked %s", oname, user);
  1082. IRC_GroupSay(gGroupID,channel,string);
  1083. return 1;
  1084. }
  1085.  
  1086. IRCCMD:givemoney(botid, channel[], user[], host[], params[])
  1087. {
  1088. new string[128],
  1089. ID,
  1090. amount;
  1091.  
  1092. if(sscanf(params, "ii", ID, amount))
  1093. return IRC_GroupSay(gGroupID, channel, "Use: !givemoney [ID] [AMMOUNT]");
  1094.  
  1095. if(IRC_IsOp(botid,channel,user))
  1096.  
  1097. if(!IsPlayerConnected(ID))
  1098. return IRC_GroupSay(gGroupID, channel,"4*** Error: Invalid player ID.");
  1099.  
  1100. GivePlayerMoney(ID, amount);
  1101.  
  1102. new oname[MAX_PLAYER_NAME];
  1103. GetPlayerName(ID, oname, sizeof(oname));
  1104.  
  1105. format(string, sizeof(string), "\"%s\" has been given $%d by IRC admin \"%s\"", oname, amount, user);
  1106. IRC_GroupSay(gGroupID,channel,string);
  1107. return 1;
  1108. }
  1109.  
  1110. IRCCMD:setname(botid, channel[], user[], host[], params[])
  1111. {
  1112.  
  1113. new string[128], ID, newname[32];
  1114. if(sscanf(params, "is", ID, newname))
  1115. return IRC_GroupSay(gGroupID, channel, "Use: !setname [ID] [NAME]");
  1116.  
  1117. if(IRC_IsOwner(botid, channel, user))
  1118. if(!IsPlayerConnected(ID))
  1119. return IRC_GroupSay(gGroupID, channel,"4*** Error: Invalid player ID.");
  1120. new oname[MAX_PLAYER_NAME];
  1121. GetPlayerName(ID, oname, sizeof(oname));
  1122. format(string, sizeof(string), "%s has had his name set to %s by IRC admin %s", oname, newname, user);
  1123. SetPlayerName(ID, newname);
  1124. IRC_GroupSay(gGroupID,channel,string);
  1125. return 1;
  1126. }
  1127.  
  1128. IRCCMD:ip(botid, channel[], user[], host[], params[])
  1129. {
  1130. new giveid, msg[256], Ip[256];
  1131.  
  1132. if(IRC_IsHalfop(botid, channel, user))
  1133. if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !ip <PlayerName/PlayerID>");
  1134. giveid = ReturnUser(params);
  1135. if(!IsPlayerConnected(giveid)) return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  1136. GetPlayerIp(giveid,Ip,256);
  1137. format(msg,256,"3>> IP from %s (ID:%d):1 %s",PlayerName(giveid),giveid,Ip);
  1138. IRC_GroupSay(gGroupID,channel,msg);
  1139. return 1;
  1140. }
  1141.  
  1142. IRCCMD:pm(botid, channel[], user[], host[], params[])
  1143. {
  1144. new giveid, msg[256],lolz1[256], lolz2[256], pon[256];
  1145.  
  1146. if(sscanf(params,"ss[256]",pon,msg)) return IRC_GroupSay(gGroupID,channel,"3Usage: !pm <PlayerName/PlayerID> <Message>");
  1147. giveid = ReturnUser(pon);
  1148. if(!IsPlayerConnected(giveid))
  1149. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  1150. format(lolz1,256, "*** PM from %s (IRC): %s",user, msg);
  1151. format(lolz2,256, "5*** PM to %s (ID:%d):1 %s",PlayerName(giveid),giveid,msg);
  1152. SendClientMessage(giveid,green,lolz1);
  1153. IRC_GroupSay(gGroupID, channel, lolz2);
  1154. return 1;
  1155. }
  1156.  
  1157. IRCCMD:hp(botid, channel[], user[], host[], params[])
  1158. {
  1159. new pon[30], giveid, msg[256], Float: Health, Float: Armour;
  1160.  
  1161. if(sscanf(params,"s",pon)) return
  1162. IRC_GroupSay(gGroupID,channel,"3Usage: !hp <PlayerName/PlayerID>");
  1163. giveid = ReturnUser(pon);
  1164. if(!IsPlayerConnected(giveid)) return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  1165. GetPlayerHealth(giveid,Health);
  1166. GetPlayerArmour(giveid,Armour);
  1167. format(msg,256,"10>> (%s) Health: %s %.0f - Armour: %s %.0f",PlayerName(giveid),PercentBar(Health),Health,PercentBar(Armour),Armour);
  1168. IRC_GroupSay(gGroupID,channel,msg);
  1169. return 1;
  1170. }
  1171.  
  1172. IRCCMD:eject(botid, channel[], user[], host[], params[])
  1173. {
  1174. new giveid,msg1[256],msg2[256],msg[256],pon[100];
  1175.  
  1176. if(IRC_IsOp(botid, channel, user))
  1177. if(sscanf(params,"sz",pon,msg)) return IRC_GroupSay(gGroupID,channel,"3Usage: !eject <PlayerName/PlayerID> <Reason [Optional]>");
  1178. giveid = ReturnUser(pon);
  1179. if(!IsPlayerConnected(giveid))
  1180. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  1181. if(!IsPlayerInAnyVehicle(giveid))
  1182. return IRC_GroupSay(gGroupID,channel,"4*** Error: The selected id is not in a vehicle.");
  1183. if(!strlen(msg)) {
  1184. format(msg1,sizeof(msg1),"4*** %s (IRC) eject of the vehicle to %s (ID:%d).",user,PlayerName(giveid),giveid);
  1185. format(msg2,sizeof(msg2),"*** %s (IRC) eject of the vehicle to %s (ID:%d).",user,PlayerName(giveid),giveid);
  1186. }
  1187. else {
  1188. format(msg1,sizeof(msg1),"4*** %s (IRC) eject of the vehicle to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
  1189. format(msg2,sizeof(msg2),"*** %s (IRC) eject of the vehicle to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
  1190. }
  1191. IRC_GroupSay(gGroupID,channel,msg1);
  1192. SendClientMessageToAll(red,msg2);
  1193. RemovePlayerFromVehicle(giveid);
  1194. return 1;
  1195. }
  1196.  
  1197. IRCCMD:getid(botid, channel[], user[], host[], params[])
  1198. {
  1199.  
  1200. new GetPlayer[256],giveid,lolz1[256],lolz2[256];
  1201.  
  1202. if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !getid <PartOfName>");
  1203. for (giveid=0; giveid<=MAX_PLAYERS; giveid++){
  1204. if (IsPlayerConnected(giveid)){
  1205. GetPlayerName(giveid,GetPlayer,16);
  1206. new space = (strfind(GetPlayer, params, true));
  1207. if (space != -1){
  1208. format(lolz1, sizeof(lolz1), "10>> Player whose name is %s 10has the ID: %d", GetPlayer, giveid);
  1209. IRC_GroupSay(gGroupID,channel,lolz1);
  1210. return 1;
  1211. }
  1212. }
  1213. }
  1214. format(lolz2, sizeof(lolz2),"4*** Error: Invalid Name", params[0]);
  1215. IRC_GroupSay(gGroupID,channel,lolz2);
  1216. return 1;
  1217. }
  1218.  
  1219.  
  1220. IRCCMD:players(botid, channel[], user[], host[], params[])
  1221. {
  1222. new count, PlayerNames[512];
  1223. for(new i=0; i<=MAX_PLAYERS; i++)
  1224.  
  1225. {
  1226. if(IsPlayerConnected(i))
  1227. {
  1228. if(count == 0)
  1229. {
  1230. new PlayerName1[MAX_PLAYER_NAME];
  1231. GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
  1232. format(PlayerNames, sizeof(PlayerNames),"[%d] %s",i,PlayerName1);
  1233. count++;
  1234. }
  1235. else
  1236. {
  1237. new PlayerName1[MAX_PLAYER_NAME];
  1238. GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
  1239. format(PlayerNames, sizeof(PlayerNames),"%s, [%d] %s",PlayerNames,i,PlayerName1);
  1240. count++;
  1241. }
  1242. }
  1243. else { if(count == 0) format(PlayerNames, sizeof(PlayerNames),"No Players Online"); }
  1244. }
  1245. new counter = 0, msg[256], players = GetMaxPlayers();
  1246. for(new i=0; i<=MAX_PLAYERS; i++)
  1247. {
  1248. if(IsPlayerConnected(i)) counter++;
  1249. }
  1250. format(msg,256,"10>> Players Online [%d/%d]: %s",counter,players,PlayerNames);
  1251. IRC_GroupSay(gGroupID, channel, msg);
  1252. return 1;
  1253. }
  1254.  
  1255. IRCCMD:kill(botid, channel[], user[], host[], params[])
  1256. {
  1257. new giveid,msg1[255],msg2[255],Reason[256],pon[100];
  1258.  
  1259. if(IRC_IsOp(botid, channel, user))
  1260. if(sscanf(params,"sz[255]",pon,Reason))
  1261. return IRC_GroupSay(gGroupID,channel,"3Usage: !kill <PlayerName/PlayerID> <Reason [Optional]>");
  1262. giveid = ReturnUser(pon);
  1263. if(!IsPlayerConnected(giveid))
  1264. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Player ID");
  1265. if(!strlen(Reason)) {
  1266. format(msg1,sizeof(msg1),"4*** %s (IRC) killed player %s (ID:%d).",user,PlayerName(giveid),giveid);
  1267. format(msg2,sizeof(msg2),"*** %s (IRC) killed player %s (ID:%d).",user,PlayerName(giveid),giveid);
  1268. }
  1269. else {
  1270. format(msg1,sizeof(msg1),"4*** %s (IRC) killed player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
  1271. format(msg2,sizeof(msg2),"*** %s (IRC) killed player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
  1272. }
  1273. IRC_GroupSay(gGroupID,channel,msg1);
  1274. SendClientMessageToAll(red,msg2);
  1275. SetPlayerHealth(giveid,0);
  1276. SetPlayerArmour(giveid,0);
  1277. return 1;
  1278. }
  1279.  
  1280. IRCCMD:name(botid, channel[], user[], host[], params[])
  1281. {
  1282. new msg1[256];
  1283. if(isnull(params))
  1284.  
  1285. return IRC_GroupSay(gGroupID,channel,"3Usage: !name <PlayerID>");
  1286. if(!IsPlayerConnected(strval(params)))
  1287. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Player ID");
  1288. format(msg1,256,"10>> ID: %d 10is %s",strval(params),PlayerName(strval(params)));
  1289. IRC_GroupSay(gGroupID,channel,msg1);
  1290. return 1;
  1291. }
  1292.  
  1293. IRCCMD:disarm(botid, channel[], user[], host[], params[])
  1294. {
  1295.  
  1296. new giveid,msg[256],msg1[256],msg2[256],pon[100];
  1297.  
  1298. if(IRC_IsOp(botid, channel, user))
  1299. if(sscanf(params,"sz",pon,msg))
  1300. return IRC_GroupSay(gGroupID,channel,"3Usage: !disarm <PlayerName/PlayerID> <Reason [Optional]>");
  1301. giveid = ReturnUser(pon);
  1302. if(!IsPlayerConnected(giveid))
  1303. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  1304. if(GetPlayerTotalWeapons(giveid) == 0)
  1305. return IRC_GroupSay(gGroupID,channel,"4*** Error: The player has no weapon.");
  1306. if(!strlen(msg)) {
  1307. format(msg1,sizeof(msg1),"4*** %s (IRC) removed the weapons to %s (ID:%d).",user,PlayerName(giveid),giveid);
  1308. format(msg2,sizeof(msg2),"*** %s (IRC) removed the weapons to %s (ID:%d).",user,PlayerName(giveid),giveid);
  1309. }
  1310. else {
  1311. format(msg1,sizeof(msg1),"4*** %s (IRC) removed the weapons to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
  1312. format(msg2,sizeof(msg2),"*** %s (IRC) removed the weapons to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
  1313. }
  1314. SendClientMessageToAll(red,msg2);
  1315. IRC_GroupSay(gGroupID,channel,msg1);
  1316. ResetPlayerWeapons(giveid);
  1317. return 1;
  1318. }
  1319.  
  1320. IRCCMD:time(botid, channel[], user[], host[], params[])
  1321. {
  1322. new msg1[256],hour,minute,second,year,month,day;
  1323.  
  1324. gettime(hour,minute,second);
  1325. getdate(year,month,day);
  1326. format(msg1,256,"10>> Day: %02d/%02d/%02d 10Hour: %02d:%02d:%02d",day,month,year,hour,minute,second);
  1327. IRC_GroupSay(gGroupID,channel,msg1);
  1328. return 1;
  1329. }
  1330.  
  1331. IRCCMD:money(botid, channel[], user[], host[], params[])
  1332. {
  1333. new giveid,msg1[256];
  1334. if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !money <PlayerName/PlayerID>");
  1335. giveid = ReturnUser(params);
  1336.  
  1337. if(!IsPlayerConnected(giveid))
  1338. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  1339. format(msg1,256,"10>> Money from %s (ID:%d): $%d",PlayerName(giveid),giveid,GetPlayerMoney(giveid));
  1340. IRC_GroupSay(gGroupID,channel,msg1);
  1341. return 1;
  1342. }
  1343.  
  1344. IRCCMD:fakemsg(botid, channel[], user[], host[], params[])
  1345. {
  1346. new giveid,msg[256],lolz1[256],pon[100];
  1347.  
  1348. if(IRC_IsAdmin(botid, channel, user))
  1349. if(sscanf(params,"ss",pon,msg))
  1350. return IRC_GroupSay(gGroupID,channel,"3Usage: !fakemsg <PlayerName/PlayerID> <Message>");
  1351. giveid = ReturnUser(pon);
  1352. if(!IsPlayerConnected(giveid))
  1353. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
  1354. format(lolz1,256,"2[%i]7 %s: %s",giveid,PlayerName(giveid),msg);
  1355. SendPlayerMessageToAll(giveid,msg);
  1356. IRC_GroupSay(gGroupID,channel,lolz1);
  1357. return 1;
  1358. }
  1359.  
  1360. IRCCMD:ann(botid, channel[], user[], host[], params[])
  1361. {
  1362. new lolz[256];
  1363.  
  1364. if(IRC_IsOp(botid, channel, user))
  1365. if(!strlen(params))
  1366. return IRC_GroupSay(gGroupID, channel,"5Correct Usage: !ann <message>");
  1367. format(lolz, 256, "2Announcement from %s: %s", user, params);
  1368. IRC_GroupSay(gGroupID, channel, lolz);
  1369. SendClientMessageToAll(blue,"-------------------------------------------");
  1370. SendClientMessageToAll(red,params);
  1371. SendClientMessageToAll(blue,"-------------------------------------------");
  1372. return true;
  1373. }
  1374.  
  1375. IRCCMD:hostname(botid, channel[], user[], host[], params[])
  1376. {
  1377.  
  1378. if(IRC_IsOwner(botid,channel,user))
  1379. {
  1380. new cmd[45];
  1381. format(cmd,sizeof cmd,"hostname %s",params);
  1382. SendRconCommand(cmd);
  1383. IRC_GroupSay(gGroupID, channel,"2Server Hostname Set.");
  1384.  
  1385. }
  1386. else IRC_GroupSay(gGroupID, channel,"4Error: You must be owner to use this command.");
  1387. return 1;
  1388. }
  1389.  
  1390.  
  1391. IRCCMD:mapname(botid, channel[], user[], host[], params[])
  1392. {
  1393.  
  1394. if(IRC_IsOwner(botid,channel,user))
  1395. {
  1396. new cmd[45];
  1397. format(cmd,sizeof cmd,"mapname %s",params);
  1398. SendRconCommand(cmd);
  1399. IRC_GroupSay(gGroupID, channel,"2Server Mapname Set.");
  1400.  
  1401. }
  1402. else IRC_GroupSay(gGroupID, channel,"4Error: You must be owner to use this command.");
  1403. return 1;
  1404. }
  1405.  
  1406.  
  1407. IRCCMD:part(botid, channel[], user[], host[], params[])
  1408. {
  1409. new id,msg[100],chan[100],msg1[100];
  1410.  
  1411. if(IRC_IsOwner(botid,channel,user))
  1412. if(sscanf(params,"ds",id,chan)) return IRC_GroupSay(gGroupID,channel,"3Usage: !part <channel>");
  1413. if(id == 1) {
  1414. if(strfind(chan,"#",true,0)!= -1)
  1415. {
  1416. format(msg,256,"3>> %s has left of the channel %s",BOT_1_NICKNAME, chan);
  1417. IRC_GroupSay(gGroupID, channel, msg);
  1418. IRC_PartChannel(botid,chan);
  1419. }
  1420. else
  1421. {
  1422. format(msg1,256,"#%s",chan);
  1423. format(msg,256,"3>> %s has left of the channel %s",BOT_1_NICKNAME, msg1);
  1424. IRC_GroupSay(gGroupID, channel, msg);
  1425. IRC_PartChannel(botid,msg1);
  1426. }
  1427. }
  1428. else return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Bot ID. (1/2)");
  1429. return 1;
  1430. }
  1431.  
  1432.  
  1433.  
  1434.  
  1435. IRCCMD:cmds(botid, channel[], user[], host[], params[])
  1436. {
  1437.  
  1438. if(IRC_IsVoice(botid, channel, user))
  1439. IRC_GroupSay(gGroupID, channel,"Voice Cmds: !name, !getid, !players, !pm, !say, !admins, !score, !credits");
  1440. if(IRC_IsHalfop(botid, channel, user))
  1441. IRC_GroupSay(gGroupID, channel, "Halfop Cmds: !Hp, !Ip, !Money, !Freeze, !UnFreeze, !kick, !Jail, !unjail, !warn, !admin.");
  1442. if(IRC_IsOp(botid, channel, user))
  1443. IRC_GroupSay(gGroupID, channel, "Op Cmds: !ban, !explode, !banip, !eject, !asay, !Kill, !disarm, !ann, !slap, !force, !xyz, !sethp, !text.");
  1444. if(IRC_IsAdmin(botid, channel, user))
  1445. IRC_GroupSay(gGroupID, channel, "Admin Cmds: !givemoney, !gmx, !fakemsg, !giveweapon,");
  1446. if(IRC_IsOwner(botid, channel, user))
  1447. IRC_GroupSay(gGroupID, channel, "Owner Cmds: !rcon, !setname, !osay, !hostname, !mapname, !raw, !part, !join, !quarantine.");
  1448. return true;
  1449. }
  1450.  
  1451.  
  1452. IRCCMD:join(botid, channel[], user[], host[], params[])
  1453. {
  1454. new id,msg[100],chan[100],pass[20],msg1[100];
  1455.  
  1456. if(IRC_IsAdmin(botid, channel, user))
  1457. if(sscanf(params,"dsz",id,chan,pass)) return IRC_GroupSay(gGroupID,channel,"3Usage: !join <channel>");
  1458. if(id == 1)
  1459. {
  1460. if(strfind(chan,"#",true,0)!= -1)
  1461. {
  1462. if(IRC_IsUserOnChannel(botid,chan,BOT_1_NICKNAME) == 1)
  1463. return IRC_GroupSay(gGroupID,channel,"4*** Error: Bot already in the channel.");
  1464. format(msg,256,"3>> %s has joined to %s",BOT_1_NICKNAME, chan);
  1465. IRC_GroupSay(gGroupID, channel, msg);
  1466. if(!strlen(pass)) IRC_JoinChannel(botid,chan,"");
  1467. else IRC_JoinChannel(botid,chan,pass);
  1468. }
  1469. else
  1470. {
  1471. format(msg1,256,"#%s",chan);
  1472. if(IRC_IsUserOnChannel(botid,msg1,BOT_1_NICKNAME) == 1) return IRC_GroupSay(gGroupID,channel,"4*** Error: Bot already in the channel.");
  1473. format(msg,256,"3>> %s has joined to %s",botid, msg1);
  1474. IRC_GroupSay(gGroupID,channel, msg);
  1475. if(!strlen(pass)) IRC_JoinChannel(botid,msg1,"");
  1476. else IRC_JoinChannel(botid,msg1,pass);
  1477. }
  1478. }
  1479. else return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Bot ID.");
  1480. return 1;
  1481. }
  1482.  
  1483.  
  1484.  
  1485. IRCCMD:xyz(botid, channel[], user[], host[], params[])
  1486. {
  1487. new giveid, msg1[256];
  1488.  
  1489. if(IRC_IsAdmin(botid, channel, user))
  1490. if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !xyz <PlayerName/PlayerID>");
  1491. giveid = ReturnUser(params);
  1492. new Float:X,Float:Y,Float:Z,Float:A;
  1493. GetPlayerPos(giveid,X,Y,Z);
  1494. GetPlayerFacingAngle(giveid,A);
  1495. format(msg1,256,"10>> Position from %s (ID:%d): X: %f10, Y: %f10, Z: %f10, A: %f",PlayerName(giveid),giveid,X,Y,Z,A);
  1496. IRC_GroupSay(gGroupID,channel,msg1);
  1497. return 1;
  1498. }
  1499.  
  1500. // EDIT THESE 3 Commands YOURSELF!
  1501. /*IRCCMD:admins(botid, channel[], user[], host[], params[])
  1502. {
  1503. new count,lolz1[200];
  1504. for (new giveid; giveid != GetMaxPlayers(); giveid ++)
  1505.  
  1506. {
  1507. if (!IsPlayerConnected(giveid)) continue;
  1508. if (PlayerInfo[giveid][AdminLevel] < 1)
  1509. {
  1510. if(count == 0) IRC_GroupSay(gGroupID,channel,"3*** Admin's Online:1");
  1511. GetPlayerName(giveid,lolz1,32);
  1512. format(lolz1,200,"[%d] %s",giveid,lolz1);
  1513. IRC_GroupSay(gGroupID,channel,lolz1);
  1514. count++;
  1515. }
  1516. }
  1517. if (count == 0) return IRC_GroupSay(gGroupID,channel,"4*** Unfortiantly there are no admins's online");
  1518. return true;
  1519. }*/
  1520.  
  1521. /*
  1522. IRCCMD:jail(botid, channel[], user[], host[], params[])
  1523. {
  1524.  
  1525. if(IRC_IsHalfop(botid, channel, user))
  1526. {
  1527. new
  1528. playerid,
  1529. reason[64];
  1530.  
  1531. if (sscanf(params, "ds", playerid, reason))
  1532. {
  1533. return 1;
  1534. }
  1535.  
  1536. if (IsPlayerConnected(playerid))
  1537. {
  1538. new
  1539. msg[128],
  1540. name[MAX_PLAYER_NAME];
  1541.  
  1542. if (isnull(reason))
  1543. {
  1544. format(reason, sizeof(reason), "no reason defined");
  1545. }
  1546. if(PlayerInfo[playerid][Jailed] == 1)
  1547. {
  1548. IRC_GroupSay(gGroupID, channel, "ERROR: This Player is already Jailed");
  1549. }
  1550. else
  1551. {
  1552. GetPlayerName(playerid, name, sizeof(name));
  1553. format(msg, sizeof(msg), "02*** %s has been Jailed by %s on IRC. (%s)", name, user, reason);
  1554. SendClientMessageToAll(COLOR_WHITE, msg);
  1555. IRC_GroupSay(gGroupID, channel, msg);
  1556. PlayerInfo[playerid][Jailed] = 1;
  1557. SendClientMessage(playerid,red,"Next, Learn The rules, Follow what the admins tell you");
  1558. SetPlayerPos(playerid,3619.159,-716.425,1.069);
  1559. }
  1560.  
  1561.  
  1562. }
  1563. }
  1564.  
  1565. return 1;
  1566. }
  1567.  
  1568. IRCCMD:unjail(botid, channel[], user[], host[], params[])
  1569. {
  1570.  
  1571. if (IRC_IsHalfop(botid, channel, user))
  1572. {
  1573. new
  1574. playerid,
  1575. reason[64];
  1576.  
  1577. if (sscanf(params, "ds", playerid, reason))
  1578. {
  1579. return 1;
  1580. }
  1581.  
  1582. if (IsPlayerConnected(playerid))
  1583. {
  1584. new
  1585. msg[128],
  1586. name[MAX_PLAYER_NAME];
  1587.  
  1588. if (isnull(reason))
  1589. {
  1590. format(reason, sizeof(reason), "<no reason defined>");
  1591. }
  1592. if(PlayerInfo[playerid][Jailed] == 0) {
  1593. IRC_Say(gGroupID, channel, "ERROR: Player isn't Jailed!"); }
  1594. else {
  1595.  
  1596. GetPlayerName(playerid, name, sizeof(name));
  1597. format(msg, sizeof(msg), "02*** %s Has been unjaild by %s on The IRC. (%s)", name, user, reason);
  1598. SendClientMessageToAll(COLOR_WHITE,msg);
  1599. IRC_Say(gGroupID, channel, msg);
  1600. PlayerInfo[playerid][Jailed] = 0;
  1601. SetPlayerHealth(playerid,0);
  1602. }
  1603.  
  1604.  
  1605. }
  1606. }
  1607.  
  1608. return 1;
  1609. }*/
  1610.  
  1611.  
  1612. IRCCMD:force(botid, channel[], user[], host[], params[])
  1613. {
  1614.  
  1615. new giveid,msg1[255],msg2[255],Reason[256],pon[100];
  1616. if(IRC_IsOp(botid, channel, user))
  1617.  
  1618. if(sscanf(params,"sz",pon,Reason))
  1619. return IRC_GroupSay(gGroupID,channel,"3Usage: !force <PlayerName/PlayerID> <Reason [Optional]>");
  1620. giveid = ReturnUser(pon);
  1621. if(!IsPlayerConnected(giveid))
  1622. return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Player ID");
  1623. if(!strlen(Reason)) {
  1624. format(msg1,sizeof(msg1),"4*** %s (IRC) Forced player %s (ID:%d).",user,PlayerName(giveid),giveid);
  1625. format(msg2,sizeof(msg2),"*** %s (IRC) Forced player %s (ID:%d).",user,PlayerName(giveid),giveid);
  1626. }
  1627. else {
  1628. format(msg1,sizeof(msg1),"4*** %s (IRC) Forced player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
  1629. format(msg2,sizeof(msg2),"*** %s (IRC) Forced player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
  1630. }
  1631. IRC_GroupSay(gGroupID,channel,msg1);
  1632. SendClientMessageToAll(red,msg2);
  1633. SetPlayerHealth(giveid,0);
  1634. SetPlayerArmour(giveid,0);
  1635. ForceClassSelection(giveid);
  1636. return 1;
  1637. }
  1638.  
  1639. IRCCMD:raw(botid, channel[], user[], host[], params[])
  1640. {
  1641.  
  1642. new id,msg[256],iparams[256];
  1643. if(IRC_IsOwner(botid, channel, user))
  1644.  
  1645. if(sscanf(params,"ds",id,iparams)) return IRC_GroupSay(gGroupID, channel, "3Usage: !ircraw <BotID [1/2]> <Params>");
  1646. if(id == 1)
  1647. {
  1648. format(msg,256,"3** RAW command for IRC:1 %s", iparams);
  1649. IRC_Say(gGroupID, channel, msg);
  1650. IRC_SendRaw(botid,iparams);
  1651. }
  1652. return 1;
  1653. }
  1654.  
  1655. IRCCMD:Credits(botid, channel[], user[], host[], params[])
  1656. {
  1657. IRC_GroupSay(gGroupID, channel, " This IRC Script Has Been made by Porsche911!");
  1658. return 1;
  1659. }
  1660. stock IsStringIP(string[])
  1661. {
  1662. new icnt;
  1663. new port;
  1664. for(new i=0,j=strlen(string);i<j;i++){
  1665. if(string[i] == '.') icnt++;
  1666. else if(string[i] ==':') port++;
  1667. }
  1668. if(icnt == 3){
  1669. if(port == 1) return 2;
  1670. else if(port == 0) return 1;
  1671. }
  1672. return 0;
  1673. }
  1674.  
  1675. ReturnUser(text[])
  1676. {
  1677. new pos = 0;
  1678. while (text[pos] < 0x21)
  1679. {
  1680. if (text[pos] == 0) return INVALID_PLAYER_ID;
  1681. pos++;
  1682. }
  1683. new userid = INVALID_PLAYER_ID;
  1684. if (IsNumeric(text[pos]))
  1685. {
  1686. userid = strval(text[pos]);
  1687. if (userid >=0 && userid < MAX_PLAYERS)
  1688. {
  1689. if(!IsPlayerConnected(userid))
  1690. {
  1691. userid = INVALID_PLAYER_ID;
  1692. }
  1693. else
  1694. {
  1695. return userid;
  1696. }
  1697. }
  1698. }
  1699. new giveid;
  1700. new GetPlayer[256];
  1701. for (giveid=0; giveid<=MAX_PLAYERS; giveid++)
  1702. {
  1703. if (IsPlayerConnected(giveid))
  1704. {
  1705. GetPlayerName(giveid,GetPlayer,16);
  1706. new space = (strfind(GetPlayer, text,true));
  1707. if (space != -1)
  1708. {
  1709. return giveid;
  1710. }
  1711. }
  1712. }
  1713. return userid;
  1714. }
  1715.  
  1716. stock PercentBar(Float:data)
  1717. {
  1718. new x[256];
  1719. if (data >= 100)x = "[IIIIIIIIII]";
  1720. else if (data >= 110)x = "HACKER, BAN!";
  1721. else if (data >= 90) x = "[IIIIIIIII-]";
  1722. else if (data >= 80) x = "[IIIIIIII--]";
  1723. else if (data >= 70) x = "[IIIIIII---]";
  1724. else if (data >= 60) x = "[IIIIII----]";
  1725. else if (data >= 50) x = "[IIIII-----]";
  1726. else if (data >= 40) x = "[IIII------]";
  1727. else if (data >= 30) x = "[III-------]";
  1728. else if (data >= 20) x = "[II--------]";
  1729. else if (data >= 10) x = "[I---------]";
  1730. else x = "[No HP FOUND!]";
  1731. return x;
  1732. }
  1733.  
  1734. stock GetPlayerTotalWeapons(playerid)
  1735. {
  1736. new TW = 0;
  1737. for(new a=0; a <= 9; a++){
  1738. new weapon, ammo;
  1739. GetPlayerWeaponData(playerid,a,weapon,ammo);
  1740. if(ammo != 0 && weapon != 0){
  1741. TW++;
  1742. }
  1743. }
  1744. return TW;
  1745. }
  1746.  
  1747.  
  1748.  
  1749. /*
  1750. Here is a very useful function by Y_Less for obtaining tokens from strings:
  1751. sscanf. It is used in the channel commands above. I recommend using the
  1752. plugin version (sscanf 2.0), however.
  1753. */
  1754.  
  1755. stock
  1756. sscanf(string[], format[], {Float,_}:...)
  1757. {
  1758. #if defined isnull
  1759. if (isnull(string))
  1760. #else
  1761. if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
  1762. #endif
  1763. {
  1764. return format[0];
  1765. }
  1766. #pragma tabsize 4
  1767. new
  1768. formatPos = 0,
  1769. stringPos = 0,
  1770. paramPos = 2,
  1771. paramCount = numargs(),
  1772. delim = ' ';
  1773. while (string[stringPos] && string[stringPos] <= ' ')
  1774. {
  1775. stringPos++;
  1776. }
  1777. while (paramPos < paramCount && string[stringPos])
  1778. {
  1779. switch (format[formatPos++])
  1780. {
  1781. case '\0':
  1782. {
  1783. return 0;
  1784. }
  1785. case 'i', 'd':
  1786. {
  1787. new
  1788. neg = 1,
  1789. num = 0,
  1790. ch = string[stringPos];
  1791. if (ch == '-')
  1792. {
  1793. neg = -1;
  1794. ch = string[++stringPos];
  1795. }
  1796. do
  1797. {
  1798. stringPos++;
  1799. if ('0' <= ch <= '9')
  1800. {
  1801. num = (num * 10) + (ch - '0');
  1802. }
  1803. else
  1804. {
  1805. return -1;
  1806. }
  1807. }
  1808. while ((ch = string[stringPos]) > ' ' && ch != delim);
  1809. setarg(paramPos, 0, num * neg);
  1810. }
  1811. case 'h', 'x':
  1812. {
  1813. new
  1814. num = 0,
  1815. ch = string[stringPos];
  1816. do
  1817. {
  1818. stringPos++;
  1819. switch (ch)
  1820. {
  1821. case 'x', 'X':
  1822. {
  1823. num = 0;
  1824. continue;
  1825. }
  1826. case '0' .. '9':
  1827. {
  1828. num = (num << 4) | (ch - '0');
  1829. }
  1830. case 'a' .. 'f':
  1831. {
  1832. num = (num << 4) | (ch - ('a' - 10));
  1833. }
  1834. case 'A' .. 'F':
  1835. {
  1836. num = (num << 4) | (ch - ('A' - 10));
  1837. }
  1838. default:
  1839. {
  1840. return -1;
  1841. }
  1842. }
  1843. }
  1844. while ((ch = string[stringPos]) > ' ' && ch != delim);
  1845. setarg(paramPos, 0, num);
  1846. }
  1847. case 'c':
  1848. {
  1849. setarg(paramPos, 0, string[stringPos++]);
  1850. }
  1851. case 'f':
  1852. {
  1853. setarg(paramPos, 0, _:floatstr(string[stringPos]));
  1854. }
  1855. case 'p':
  1856. {
  1857. delim = format[formatPos++];
  1858. continue;
  1859. }
  1860. case '\'':
  1861. {
  1862. new
  1863. end = formatPos - 1,
  1864. ch;
  1865. while ((ch = format[++end]) && ch != '\'') {}
  1866. if (!ch)
  1867. {
  1868. return -1;
  1869. }
  1870. format[end] = '\0';
  1871. if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
  1872. {
  1873. if (format[end + 1])
  1874. {
  1875. return -1;
  1876. }
  1877. return 0;
  1878. }
  1879. format[end] = '\'';
  1880. stringPos = ch + (end - formatPos);
  1881. formatPos = end + 1;
  1882. }
  1883. case 'u':
  1884. {
  1885. new
  1886. end = stringPos - 1,
  1887. id = 0,
  1888. bool:num = true,
  1889. ch;
  1890. while ((ch = string[++end]) && ch != delim)
  1891. {
  1892. if (num)
  1893. {
  1894. if ('0' <= ch <= '9')
  1895. {
  1896. id = (id * 10) + (ch - '0');
  1897. }
  1898. else
  1899. {
  1900. num = false;
  1901. }
  1902. }
  1903. }
  1904. if (num && IsPlayerConnected(id))
  1905. {
  1906. setarg(paramPos, 0, id);
  1907. }
  1908. else
  1909. {
  1910. #if !defined foreach
  1911. #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
  1912. #define __SSCANF_FOREACH__
  1913. #endif
  1914. string[end] = '\0';
  1915. num = false;
  1916. new
  1917. name[MAX_PLAYER_NAME];
  1918. id = end - stringPos;
  1919. foreach (Player, playerid)
  1920. {
  1921. GetPlayerName(playerid, name, sizeof (name));
  1922. if (!strcmp(name, string[stringPos], true, id))
  1923. {
  1924. setarg(paramPos, 0, playerid);
  1925. num = true;
  1926. break;
  1927. }
  1928. }
  1929. if (!num)
  1930. {
  1931. setarg(paramPos, 0, INVALID_PLAYER_ID);
  1932. }
  1933. string[end] = ch;
  1934. #if defined __SSCANF_FOREACH__
  1935. #undef foreach
  1936. #undef __SSCANF_FOREACH__
  1937. #endif
  1938. }
  1939. stringPos = end;
  1940. }
  1941. case 's', 'z':
  1942. {
  1943. new
  1944. i = 0,
  1945. ch;
  1946. if (format[formatPos])
  1947. {
  1948. while ((ch = string[stringPos++]) && ch != delim)
  1949. {
  1950. setarg(paramPos, i++, ch);
  1951. }
  1952. if (!i)
  1953. {
  1954. return -1;
  1955. }
  1956. }
  1957. else
  1958. {
  1959. while ((ch = string[stringPos++]))
  1960. {
  1961. setarg(paramPos, i++, ch);
  1962. }
  1963. }
  1964. stringPos--;
  1965. setarg(paramPos, i, '\0');
  1966. }
  1967. default:
  1968. {
  1969. continue;
  1970. }
  1971. }
  1972. while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
  1973. {
  1974. stringPos++;
  1975. }
  1976. while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
  1977. {
  1978. stringPos++;
  1979. }
  1980. paramPos++;
  1981. }
  1982. do
  1983. {
  1984. if ((delim = format[formatPos++]) > ' ')
  1985. {
  1986. if (delim == '\'')
  1987. {
  1988. while ((delim = format[formatPos++]) && delim != '\'') {}
  1989. }
  1990. else if (delim != 'z')
  1991. {
  1992. return delim;
  1993. }
  1994. }
  1995. }
  1996. while (delim > ' ');
  1997. return 0;
  1998. }
  1999.  
  2000.  
  2001. stock Crash(playerid)
  2002. {
  2003. return ApplyAnimation(playerid, "GANG", "DRUGS_BUY", 10, 0, 0, 0, 0, 5*1000);
  2004. }
  2005.  
  2006. stock PlayerName(playerid)
  2007. {
  2008. new name[MAX_PLAYER_NAME];
  2009. GetPlayerName(playerid,name,MAX_PLAYER_NAME);
  2010. return name;
  2011. }
  2012.  
  2013. IsNumeric(const string[])
  2014. {
  2015. for (new i = 0, j = strlen(string); i < j; i++)
  2016. {
  2017. if (string[i] > '9' || string[i] < '0') return 0;
  2018. }
  2019. return 1;
  2020. }
  2021.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement