Advertisement
Guest User

Xoom-irc script v2

a guest
Mar 19th, 2013
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*this irc script made by Xoomer
  2. Dont remove credits */
  3.  
  4.  
  5. #include <a_samp>
  6. // irc.inc from this package
  7. #include <irc>
  8. // sscanf2.inc from the sscanf plugin
  9. #include <sscanf2>
  10.  
  11. // Name that everyone will see
  12. #define BOT_1_NICKNAME "GamerZZ"
  13. // Name that will only be visible in a whois
  14. #define BOT_1_REALNAME "Xoomer"
  15. // Name that will be in front of the hostname (username@hostname)
  16. #define BOT_1_USERNAME "Xoomer"
  17.  
  18. #define BOT_2_NICKNAME "GamerZX"
  19. #define BOT_2_REALNAME "Xoomer"
  20. #define BOT_2_USERNAME "Xoomer"
  21.  
  22. #define IRC_SERVER "IRC SERVER"
  23. #define IRC_PORT 6667
  24. #define IRC_CHANNEL "#channel"
  25. #define BotPass "123"
  26. // Maximum number of bots in the filterscript
  27. #define MAX_BOTS (2)
  28. #define MAX_WARNINGS 3
  29. #define PLUGIN_VERSION "1.4.3"
  30.  
  31. new botIDs[MAX_BOTS], groupID;
  32. new Warns[MAX_PLAYERS];
  33. stock FlipVehicle(playerid)
  34. {
  35. new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle;
  36. GetPlayerPos(playerid, X, Y, Z);
  37. VehicleID = GetPlayerVehicleID(playerid);
  38. GetVehicleZAngle(VehicleID, Angle);
  39. SetVehiclePos(VehicleID, X, Y, Z);
  40. SetVehicleZAngle(VehicleID, Angle);
  41. }
  42. /*
  43. When the filterscript is loaded, two bots will connect and a group will be
  44. created for them.
  45. */
  46.  
  47. public OnFilterScriptInit()
  48. {
  49. // Connect the first bot
  50. botIDs[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  51. // Set the connect delay for the first bot to 20 seconds
  52. IRC_SetIntData(botIDs[0], E_IRC_CONNECT_DELAY, 20);
  53. // Connect the second bot
  54. botIDs[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
  55. // Set the connect delay for the second bot to 30 seconds
  56. IRC_SetIntData(botIDs[1], E_IRC_CONNECT_DELAY, 30);
  57. // Create a group (the bots will be added to it upon connect)
  58. groupID = IRC_CreateGroup();
  59. }
  60.  
  61. /*
  62. When the filterscript is unloaded, the bots will disconnect, and the group
  63. will be destroyed.
  64. */
  65.  
  66. public OnFilterScriptExit()
  67. {
  68. // Disconnect the first bot
  69. IRC_Quit(botIDs[0], "Filterscript exiting");
  70. // Disconnect the second bot
  71. IRC_Quit(botIDs[1], "Filterscript exiting");
  72. // Destroy the group
  73. IRC_DestroyGroup(groupID);
  74. }
  75.  
  76. /*
  77. The standard SA-MP callbacks are below. We will echo a few of them to the
  78. IRC channel.
  79. */
  80.  
  81. public OnPlayerConnect(playerid)
  82. {
  83. new joinMsg[128], name[MAX_PLAYER_NAME];
  84. GetPlayerName(playerid, name, sizeof(name));
  85. format(joinMsg, sizeof(joinMsg), "02[%d] 03*** %s has joined the server.", playerid, name);
  86. IRC_GroupSay(groupID, IRC_CHANNEL, joinMsg);
  87. Warns[playerid] = 0;
  88. return 1;
  89. }
  90.  
  91. public OnPlayerDisconnect(playerid, reason)
  92. {
  93. new leaveMsg[128], name[MAX_PLAYER_NAME], reasonMsg[8];
  94. switch(reason)
  95. {
  96. case 0: reasonMsg = "Timeout";
  97. case 1: reasonMsg = "Leaving";
  98. case 2: reasonMsg = "Kicked";
  99. }
  100. Warns[playerid] = 0;
  101. GetPlayerName(playerid, name, sizeof(name));
  102. format(leaveMsg, sizeof(leaveMsg), "02[%d] 03*** %s has left the server. (%s)", playerid, name, reasonMsg);
  103. IRC_GroupSay(groupID, IRC_CHANNEL, leaveMsg);
  104. return 1;
  105. }
  106.  
  107. public OnPlayerDeath(playerid, killerid, reason)
  108. {
  109. new msg[128], killerName[MAX_PLAYER_NAME], reasonMsg[32], playerName[MAX_PLAYER_NAME];
  110. GetPlayerName(killerid, killerName, sizeof(killerName));
  111. GetPlayerName(playerid, playerName, sizeof(playerName));
  112. if (killerid != INVALID_PLAYER_ID)
  113. {
  114. switch (reason)
  115. {
  116. case 0: reasonMsg = "Unarmed";
  117. case 1: reasonMsg = "Brass Knuckles";
  118. case 2: reasonMsg = "Golf Club";
  119. case 3: reasonMsg = "Night Stick";
  120. case 4: reasonMsg = "Knife";
  121. case 5: reasonMsg = "Baseball Bat";
  122. case 6: reasonMsg = "Shovel";
  123. case 7: reasonMsg = "Pool Cue";
  124. case 8: reasonMsg = "Katana";
  125. case 9: reasonMsg = "Chainsaw";
  126. case 10: reasonMsg = "Dildo";
  127. case 11: reasonMsg = "Dildo";
  128. case 12: reasonMsg = "Vibrator";
  129. case 13: reasonMsg = "Vibrator";
  130. case 14: reasonMsg = "Flowers";
  131. case 15: reasonMsg = "Cane";
  132. case 22: reasonMsg = "Pistol";
  133. case 23: reasonMsg = "Silenced Pistol";
  134. case 24: reasonMsg = "Desert Eagle";
  135. case 25: reasonMsg = "Shotgun";
  136. case 26: reasonMsg = "Sawn-off Shotgun";
  137. case 27: reasonMsg = "Combat Shotgun";
  138. case 28: reasonMsg = "MAC-10";
  139. case 29: reasonMsg = "MP5";
  140. case 30: reasonMsg = "AK-47";
  141. case 31: reasonMsg = "M4";
  142. case 32: reasonMsg = "TEC-9";
  143. case 33: reasonMsg = "Country Rifle";
  144. case 34: reasonMsg = "Sniper Rifle";
  145. case 37: reasonMsg = "Fire";
  146. case 38: reasonMsg = "Minigun";
  147. case 41: reasonMsg = "Spray Can";
  148. case 42: reasonMsg = "Fire Extinguisher";
  149. case 49: reasonMsg = "Vehicle Collision";
  150. case 50: reasonMsg = "Vehicle Collision";
  151. case 51: reasonMsg = "Explosion";
  152. default: reasonMsg = "Unknown";
  153. }
  154. format(msg, sizeof(msg), "04*** %s killed %s. (%s)", killerName, playerName, reasonMsg);
  155. }
  156. else
  157. {
  158. switch (reason)
  159. {
  160. case 53: format(msg, sizeof(msg), "04*** %s died. (Drowned)", playerName);
  161. case 54: format(msg, sizeof(msg), "04*** %s died. (Collision)", playerName);
  162. default: format(msg, sizeof(msg), "04*** %s died.", playerName);
  163. }
  164. }
  165. IRC_GroupSay(groupID, IRC_CHANNEL, msg);
  166. return 1;
  167. }
  168.  
  169. public OnPlayerText(playerid, text[])
  170. {
  171. new name[MAX_PLAYER_NAME], ircMsg[256];
  172. GetPlayerName(playerid, name, sizeof(name));
  173. format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, name, text);
  174. IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg);
  175. return 1;
  176. }
  177.  
  178. /*
  179. The IRC callbacks are below. Many of these are simply derived from parsed
  180. raw messages received from the IRC server. They can be used to inform the
  181. bot of new activity in any of the channels it has joined.
  182. */
  183.  
  184. /*
  185. This callback is executed whenever a bot successfully connects to an IRC
  186. server.
  187. */
  188.  
  189. public IRC_OnConnect(botid, ip[], port)
  190. {
  191. printf("*** IRC_OnConnect: Bot ID %d connected to %s:%d", botid, ip, port);
  192. // Join the channel
  193. IRC_JoinChannel(botid, IRC_CHANNEL);
  194. // Add the bot to the group
  195. IRC_AddToGroup(groupID, botid);
  196. return 1;
  197. }
  198.  
  199. /*
  200. This callback is executed whenever a current connection is closed. The
  201. plugin may automatically attempt to reconnect per user settings. IRC_Quit
  202. may be called at any time to stop the reconnection process.
  203. */
  204.  
  205. public IRC_OnDisconnect(botid, ip[], port, reason[])
  206. {
  207. printf("*** IRC_OnDisconnect: Bot ID %d disconnected from %s:%d (%s)", botid, ip, port, reason);
  208. // Remove the bot from the group
  209. IRC_RemoveFromGroup(groupID, botid);
  210. return 1;
  211. }
  212.  
  213. /*
  214. This callback is executed whenever a connection attempt begins. IRC_Quit may
  215. be called at any time to stop the reconnection process.
  216. */
  217.  
  218. public IRC_OnConnectAttempt(botid, ip[], port)
  219. {
  220. printf("*** IRC_OnConnectAttempt: Bot ID %d attempting to connect to %s:%d...", botid, ip, port);
  221. return 1;
  222. }
  223.  
  224. /*
  225. This callback is executed whenever a connection attempt fails. IRC_Quit may
  226. be called at any time to stop the reconnection process.
  227. */
  228.  
  229. public IRC_OnConnectAttemptFail(botid, ip[], port, reason[])
  230. {
  231. printf("*** IRC_OnConnectAttemptFail: Bot ID %d failed to connect to %s:%d (%s)", botid, ip, port, reason);
  232. return 1;
  233. }
  234.  
  235. /*
  236. This callback is executed whenever a bot joins a channel.
  237. */
  238.  
  239. public IRC_OnJoinChannel(botid, channel[])
  240. {
  241. printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s", botid, channel);
  242. return 1;
  243. }
  244.  
  245. /*
  246. This callback is executed whenevever a bot leaves a channel.
  247. */
  248.  
  249. public IRC_OnLeaveChannel(botid, channel[], message[])
  250. {
  251. printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)", botid, channel, message);
  252. return 1;
  253. }
  254.  
  255. /*
  256. This callback is executed whenevever a bot is invited to a channel.
  257. */
  258.  
  259. public IRC_OnInvitedToChannel(botid, channel[], invitinguser[], invitinghost[])
  260. {
  261. printf("*** IRC_OnInvitedToChannel: Bot ID %d invited to channel %s by %s (%s)", botid, channel, invitinguser, invitinghost);
  262. IRC_JoinChannel(botid, channel);
  263. return 1;
  264. }
  265.  
  266. /*
  267. This callback is executed whenevever a bot is kicked from a channel. If the
  268. bot cannot immediately rejoin the channel (in the event, for example, that
  269. the bot is kicked and then banned), you might want to set up a timer here
  270. for rejoin attempts.
  271. */
  272.  
  273. public IRC_OnKickedFromChannel(botid, channel[], oppeduser[], oppedhost[], message[])
  274. {
  275. printf("*** IRC_OnKickedFromChannel: Bot ID %d kicked by %s (%s) from channel %s (%s)", botid, oppeduser, oppedhost, channel, message);
  276. IRC_JoinChannel(botid, channel);
  277. return 1;
  278. }
  279.  
  280. public IRC_OnUserDisconnect(botid, user[], host[], message[])
  281. {
  282. printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected (%s)", botid, user, host, message);
  283. return 1;
  284. }
  285.  
  286. public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
  287. {
  288. printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s", botid, user, host, channel);
  289. IRC_IsVoice(botid, IRC_CHANNEL, "+v");
  290. return 1;
  291. }
  292.  
  293. public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
  294. {
  295. printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)", botid, user, host, channel, message);
  296. return 1;
  297. }
  298.  
  299. public IRC_OnUserKickedFromChannel(botid, channel[], kickeduser[], oppeduser[], oppedhost[], message[])
  300. {
  301. printf("*** IRC_OnUserKickedFromChannel (Bot ID %d): User %s kicked by %s (%s) from channel %s (%s)", botid, kickeduser, oppeduser, oppedhost, channel, message);
  302. }
  303.  
  304. public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
  305. {
  306. printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his/her nick to %s", botid, oldnick, host, newnick);
  307. return 1;
  308. }
  309.  
  310. public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
  311. {
  312. printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s", botid, user, host, channel, mode);
  313. if(IRC_IsOp(botid, IRC_CHANNEL, user))
  314. {
  315. IRC_IsVoice(botid, IRC_CHANNEL, "+v");
  316. return 1;
  317. }
  318. return 1;
  319. }
  320.  
  321. public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
  322. {
  323. printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s", botid, user, host, channel, topic);
  324. return 1;
  325. }
  326.  
  327. public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
  328. {
  329. printf("*** IRC_OnUserSay (Bot ID %d): User %s (%s) sent message to %s: %s", botid, user, host, recipient, message);
  330. // Someone sent the first bot a private message
  331. if (!strcmp(recipient, BOT_1_NICKNAME))
  332. {
  333. IRC_Say(botid, user, "You sent me a PM!");
  334. }
  335. return 1;
  336. }
  337.  
  338. public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
  339. {
  340. printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
  341. // Someone sent the second bot a notice (probably a network service)
  342. if (!strcmp(recipient, BOT_2_NICKNAME))
  343. {
  344. IRC_Notice(botid, user, "You sent me a notice!");
  345. }
  346. return 1;
  347. }
  348.  
  349. public IRC_OnUserRequestCTCP(botid, user[], host[], message[])
  350. {
  351. printf("*** IRC_OnUserRequestCTCP (Bot ID %d): User %s (%s) sent CTCP request: %s", botid, user, host, message);
  352. // Someone sent a CTCP VERSION request
  353. if (!strcmp(message, "VERSION"))
  354. {
  355. IRC_ReplyCTCP(botid, user, "VERSION SA-MP IRC Plugin v" #PLUGIN_VERSION "");
  356. }
  357. return 1;
  358. }
  359.  
  360. public IRC_OnUserReplyCTCP(botid, user[], host[], message[])
  361. {
  362. printf("*** IRC_OnUserReplyCTCP (Bot ID %d): User %s (%s) sent CTCP reply: %s", botid, user, host, message);
  363. return 1;
  364. }
  365.  
  366. /*
  367. This callback is useful for logging, debugging, or catching error messages
  368. sent by the IRC server.
  369. */
  370.  
  371. public IRC_OnReceiveRaw(botid, message[])
  372. {
  373. new File:file;
  374. if (!fexist("irc_log.txt"))
  375. {
  376. file = fopen("irc_log.txt", io_write);
  377. }
  378. else
  379. {
  380. file = fopen("irc_log.txt", io_append);
  381. }
  382. if (file)
  383. {
  384. fwrite(file, message);
  385. fwrite(file, "\r\n");
  386. fclose(file);
  387. }
  388. return 1;
  389. }
  390.  
  391. /*
  392. Some examples of channel commands are here. You can add more very easily;
  393. their implementation is identical to that of ZeeX's zcmd.
  394. */
  395.  
  396. IRCCMD:say(botid, channel[], user[], host[], params[])
  397. {
  398. // Check if the user has at least voice in the channel
  399. if (IRC_IsVoice(botid, channel, user))
  400. {
  401. // Check if the user entered any text
  402. if (!isnull(params))
  403. {
  404. new msg[128];
  405. // Echo the formatted message
  406. format(msg, sizeof(msg), "02*** %s on IRC: %s", user, params);
  407. IRC_GroupSay(groupID, channel, msg);
  408. format(msg, sizeof(msg), "{FFFFFF}*** %s on IRC: %s", user, params);
  409. SendClientMessageToAll(0xFFFFFFFF, msg);
  410. }
  411. }
  412. return 1;
  413. }
  414. IRCCMD:warn(botid, channel[], user[], host[], params[])
  415. {
  416. // Check if the user is at least a halfop in the channel
  417. if (IRC_IsOp(botid, channel, user))
  418. {
  419. new playerid, reason[64];
  420. // Check if the user at least entered a player ID
  421. if (sscanf(params, "dS(No reason)[64]", playerid, reason)) return IRC_GroupSay(groupID, channel, "Syntax: !warn playerid reason");
  422. // Check if the player is connected
  423. if (IsPlayerConnected(playerid))
  424. {
  425. // warns the player
  426. // Echo the formatted message
  427.  
  428. new msg[128], name[MAX_PLAYER_NAME];
  429. Warns[playerid]++;
  430. GetPlayerName(playerid, name, sizeof(name));
  431. format(msg, sizeof(msg), "02*** %s has been warned by %s on IRC.(warning: %d/3) (Reason: %s)", name, user, Warns[playerid],reason);
  432. IRC_GroupSay(groupID, channel, msg);
  433. format(msg, sizeof(msg), "*** %s has been warned by %s on IRC.(warning: %d/3) (Reason: %s)", name, user, Warns[playerid],reason);
  434. SendClientMessageToAll(0x0000FFFF, msg);
  435.  
  436. if(Warns[playerid] == MAX_WARNINGS)
  437. {
  438. GetPlayerName(playerid, name, sizeof(name));
  439. format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. reason: warning 3/3", name, user);
  440. IRC_GroupSay(groupID, channel, msg);
  441. format(msg, sizeof(msg), "*** %s has been warned by %s on IRC. reason: warning 3/3", name, user);
  442. SendClientMessageToAll(0x0000FFFF, msg);
  443. Kick(playerid);
  444. }
  445. }
  446. }
  447. return 1;
  448. }
  449. IRCCMD:repair(botid, channel[], user[], host[], params[])
  450. {
  451. // Check if the user is at least a halfop in the channel
  452. if (IRC_IsOp(botid, channel, user))
  453. {
  454. new playerid;
  455. // Check if the user at least entered a player ID
  456. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !repair playerid");
  457. // Check if the player is connected
  458. if (IsPlayerConnected(playerid))
  459. {
  460. // warns the player
  461. // Echo the formatted message
  462. if(IsPlayerInAnyVehicle(playerid))
  463. {
  464. new msg[128], name[MAX_PLAYER_NAME];
  465. Warns[playerid]++;
  466. GetPlayerName(playerid, name, sizeof(name));
  467. format(msg, sizeof(msg), "02***IRC Admin %s : has repaired %s's vehicle .", user, name);
  468. IRC_GroupSay(groupID, channel, msg);
  469. format(msg, sizeof(msg), "*** IRC Admin %s : has repaired %s's vehicle .", user, name);
  470. SendClientMessageToAll(0x0000FFFF, msg);
  471. RepairVehicle(playerid);
  472. }
  473. else return IRC_GroupSay(groupID, channel, "This player isn't in a vehicle");
  474. }
  475. }
  476. return 1;
  477. }
  478. IRCCMD:fix(botid, channel[], user[], host[], params[])
  479. {
  480. // Check if the user is at least a halfop in the channel
  481. if (IRC_IsOp(botid, channel, user))
  482. {
  483. new playerid;
  484. // Check if the user at least entered a player ID
  485. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !repair playerid");
  486. // Check if the player is connected
  487. if (IsPlayerConnected(playerid))
  488. {
  489. // warns the player
  490. // Echo the formatted message
  491. if(IsPlayerInAnyVehicle(playerid))
  492. {
  493. new msg[128], name[MAX_PLAYER_NAME];
  494. Warns[playerid]++;
  495. GetPlayerName(playerid, name, sizeof(name));
  496. format(msg, sizeof(msg), "02*** %s has repaired %s's vehicle on IRC.", user, name);
  497. IRC_GroupSay(groupID, channel, msg);
  498. format(msg, sizeof(msg), "*** %s has repaired %s's vehicle on IRC.", user, name);
  499. SendClientMessageToAll(0x0000FFFF, msg);
  500. RepairVehicle(playerid);
  501. }
  502. else return IRC_GroupSay(groupID, channel, "This player isn't in a vehicle");
  503. }
  504. }
  505. return 1;
  506. }
  507. IRCCMD:flip(botid, channel[], user[], host[], params[])
  508. {
  509. // Check if the user is at least a halfop in the channel
  510. if (IRC_IsOp(botid, channel, user))
  511. {
  512. new playerid;
  513. // Check if the user at least entered a player ID
  514. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !flip playerid");
  515. // Check if the player is connected
  516. if (IsPlayerConnected(playerid))
  517. {
  518. // warns the player
  519. // Echo the formatted message
  520. if(IsPlayerInAnyVehicle(playerid))
  521. {
  522. new msg[128], name[MAX_PLAYER_NAME];
  523. Warns[playerid]++;
  524. GetPlayerName(playerid, name, sizeof(name));
  525. format(msg, sizeof(msg), "02*** %s has flipped %s's vehicle on IRC.", user, name);
  526. IRC_GroupSay(groupID, channel, msg);
  527. format(msg, sizeof(msg), "*** %s has flipped %s's vehicle on IRC.", user, name);
  528. SendClientMessageToAll(0x0000FFFF, msg);
  529. FlipVehicle(playerid);
  530. }
  531. else return IRC_GroupSay(groupID, channel, "This player isn't in a vehicle");
  532. }
  533. }
  534. return 1;
  535. }
  536. IRCCMD:givecar(botid, channel[], user[], host[], params[])
  537. {
  538. // Check if the user is at least a halfop in the channel
  539. if (IRC_IsOp(botid, channel, user))
  540. {
  541. new playerid;
  542. // Check if the user at least entered a player ID
  543. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !givecar playerid");
  544. // Check if the player is connected
  545. if (IsPlayerConnected(playerid))
  546. {
  547. // warns the player
  548. // Echo the formatted message
  549. if(!IsPlayerInAnyVehicle(playerid))
  550. {
  551. new msg[128], name[MAX_PLAYER_NAME];
  552. Warns[playerid]++;
  553. GetPlayerName(playerid, name, sizeof(name));
  554. format(msg, sizeof(msg), "02*** %s has given %s a car on IRC.", user, name);
  555. IRC_GroupSay(groupID, channel, msg);
  556. format(msg, sizeof(msg), "*** %s has given %s a car on IRC.", user, name);
  557. SendClientMessageToAll(0x0000FFFF, msg);
  558. new Float:x, Float:y, Float:z, Float:a;
  559. GetPlayerPos(playerid, x, y, z);
  560. GetPlayerFacingAngle(playerid, a);
  561. PutPlayerInVehicle(playerid, CreateVehicle(411, x, y, z, a, -1, -1, 50), 0);
  562. SendClientMessage(playerid, 0x00FF00FF, "Enjoy your new car");
  563. }
  564. else return IRC_GroupSay(groupID, channel, "this player already has a Vehicle");
  565. }
  566. }
  567. return 1;
  568. }
  569. IRCCMD:kick(botid, channel[], user[], host[], params[])
  570. {
  571. // Check if the user is at least a halfop in the channel
  572. if (IRC_IsHalfop(botid, channel, user))
  573. {
  574. new playerid, reason[64];
  575. // Check if the user at least entered a player ID
  576. if (sscanf(params, "dS(No reason)[64]", playerid, reason)) return IRC_GroupSay(groupID, channel, "Syntax: !kick playerid reason");
  577. // Check if the player is connected
  578. if (IsPlayerConnected(playerid))
  579. {
  580. // Echo the formatted message
  581. new msg[128], name[MAX_PLAYER_NAME];
  582. GetPlayerName(playerid, name, sizeof(name));
  583. format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
  584. IRC_GroupSay(groupID, channel, msg);
  585. format(msg, sizeof(msg), "*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
  586. SendClientMessageToAll(0x0000FFFF, msg);
  587. // Kick the player
  588. Kick(playerid);
  589. }
  590. }
  591. return 1;
  592. }
  593.  
  594. IRCCMD:ban(botid, channel[], user[], host[], params[])
  595. {
  596. // Check if the user is at least an op in the channel
  597. if (IRC_IsOp(botid, channel, user))
  598. {
  599. new playerid, reason[64];
  600. // Check if the user at least entered a player ID
  601. if (sscanf(params, "dS(No reason)[64]", playerid, reason)) return IRC_GroupSay(groupID, channel, "Syntax: !ban playerid reason");
  602. // Check if the player is connected
  603. if (IsPlayerConnected(playerid))
  604. {
  605. // Echo the formatted message
  606. new msg[128], name[MAX_PLAYER_NAME];
  607. GetPlayerName(playerid, name, sizeof(name));
  608. format(msg, sizeof(msg), "02*** %s has been banned by %s on IRC. (%s)", name, user, reason);
  609. IRC_GroupSay(groupID, channel, msg);
  610. format(msg, sizeof(msg), "*** %s has been banned by %s on IRC. (%s)", name, user, reason);
  611. SendClientMessageToAll(0x0000FFFF, msg);
  612. // Ban the player
  613. BanEx(playerid, reason);
  614. }
  615. }
  616. return 1;
  617. }
  618.  
  619. IRCCMD:rcon(botid, channel[], user[], host[], params[])
  620. {
  621. // Check if the user is at least an op in the channel
  622. if (IRC_IsOp(botid, channel, user))
  623. {
  624. // Check if the user entered any text
  625. if (!isnull(params))
  626. {
  627. // Check if the user did not enter any invalid commands
  628. if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
  629. {
  630. // Echo the formatted message
  631. new msg[128];
  632. format(msg, sizeof(msg), "RCON command %s has been executed.", params);
  633. IRC_GroupSay(groupID, channel, msg);
  634. // Send the command
  635. SendRconCommand(params);
  636. }
  637. }
  638. }
  639. return 1;
  640. }
  641.  
  642. IRCCMD:cmds(botid, channel[], user[], host[], params[])
  643. {
  644. IRC_GroupSay(groupID,"#channel"," PLAYER IRC COMMANDS");
  645. IRC_GroupSay(groupID,"#channel","!say !getname !pm !players !forum )we will add more cmds soon");
  646. IRC_GroupSay(groupID,"#channel","ADMIN IRC COMMANDS");
  647. IRC_GroupSay(groupID,"#channe;","!Flip !respawncars !admin !ann !disarm !giveallcash !resetcash !freeze !unfreeze !slap !getinfo !spawn !givecar !repair/!fix !ban !kick !rcon ");
  648. return 1;
  649. }
  650. IRCCMD:commands(botid, channel[], user[], host[], params[])
  651. {
  652. IRC_GroupSay(groupID,"#channel"," PLAYER IRC COMMANDS");
  653. IRC_GroupSay(groupID,"#channel","!say !getname !players !forum )we will add more cmds soon");
  654. IRC_GroupSay(groupID,"#channel","ADMIN IRC COMMANDS");
  655. IRC_GroupSay(groupID,"#channe;","!Flip !respawncars !disarm !giveallcash !resetcash !freeze !unfreeze !slap !getinfo !spawn !givecar !repair/!fix !ban !kick !rcon ");
  656. return 1;
  657. }
  658. IRCCMD:credits(botid, channel[], user[], host[], params[])
  659. {
  660. IRC_GroupSay(groupID,"#channel","This IRC Script made by");
  661. IRC_GroupSay(groupID,"#channel","Xoomer");
  662. return 1;
  663. }
  664. IRCCMD:resetcash(botid, channel[], user[], host[], params[])
  665. {
  666. new playerid, reason[64];
  667. //Playerid
  668. if (sscanf(params, "dS(No reason.)[64]", playerid, reason))
  669. {
  670. return 1;
  671. }
  672. if (IRC_IsHalfop(botid, channel, user))
  673. {
  674. if(IsPlayerConnected(playerid))
  675. {
  676. new msg[128], name[MAX_PLAYER_NAME];
  677. GetPlayerName(playerid, name, sizeof(name));
  678. format(msg, sizeof(msg), "*** %s their cash has been removed cash by Admin %s on IRC for reason: %s", name, user, reason);
  679. IRC_GroupSay(groupID, channel, msg);
  680. format(msg, sizeof(msg), "*** %s their cash has been removed by Admin %s on IRC for reason: %s", name, user, reason);
  681. SendClientMessageToAll(0xFF0000C8, msg);
  682. ResetPlayerMoney(playerid);
  683. }
  684. }
  685. return 1;
  686. }
  687. IRCCMD:disarm(botid, channel[], user[], host[], params[])
  688. {
  689. new playerid, reason[64];
  690. //Playerid
  691. if (sscanf(params, "dS(No reason.)[64]", playerid, reason))
  692. {
  693. return 1;
  694. }
  695. if (IRC_IsHalfop(botid, channel, user))
  696. {
  697. if(IsPlayerConnected(playerid))
  698. {
  699. new msg[128], name[MAX_PLAYER_NAME];
  700. GetPlayerName(playerid, name, sizeof(name));
  701. format(msg, sizeof(msg), "*** %s has been disarmed by Admin %s on IRC for reason: %s", name, user, reason);
  702. IRC_GroupSay(groupID, channel, msg);
  703. format(msg, sizeof(msg), "*** %s has been disarmed by Admin %s on IRC for reason: %s", name, user, reason);
  704. SendClientMessageToAll(0xFF0000C8, msg);
  705. ResetPlayerWeapons(playerid);
  706. }
  707. }
  708. return 1;
  709. }
  710. IRCCMD:giveallcash(botid, channel[], user[], host[], params[])
  711. {
  712. new value;
  713. new msg1[128];
  714. new msg2[128];
  715.  
  716. if(sscanf(params, "d", value) != 0)
  717. {
  718. return 1;
  719. }
  720. if (IRC_IsHalfop(botid, channel, user))
  721. {
  722. for(new i=0; i<MAX_PLAYERS; i++)
  723. {
  724. if(IsPlayerConnected(i))
  725. {
  726. GivePlayerMoney(i, value);
  727. format(msg1, sizeof(msg1), "*** Admin %s has given all players some cash!", user);
  728. IRC_GroupSay(groupID, channel, msg1);
  729. format(msg2, sizeof(msg2), "*** Admin %s has given all players some cash!", user);
  730. SendClientMessageToAll(0x00E600C8, msg2);
  731. }
  732. }
  733. }
  734. return 1;
  735. }
  736. IRCCMD:getname(botid, channel[], user[], host[], params[])
  737. {
  738. new playerid;
  739. //Playerid
  740. if (sscanf(params, "d", playerid))
  741. {
  742. return 1;
  743. }
  744. if(IsPlayerConnected(playerid))
  745. {
  746. new msg[128], name[MAX_PLAYER_NAME];
  747. GetPlayerName(playerid, name, sizeof(name));
  748. format(msg, sizeof(msg), "*** Online player's name %s", name, user);
  749. IRC_GroupSay(groupID, channel, msg);
  750. }
  751. return 1;
  752. }
  753. IRCCMD:spawn(botid, channel[], user[], host[], params[])
  754. {
  755. new playerid, reason[64];
  756. //Playerid
  757. if (sscanf(params, "dS(No reason.)[64]", playerid, reason))
  758. {
  759. return 1;
  760. }
  761. if (IRC_IsHalfop(botid, channel, user))
  762. {
  763. if(IsPlayerConnected(playerid))
  764. {
  765. new msg[128], name[MAX_PLAYER_NAME];
  766. GetPlayerName(playerid, name, sizeof(name));
  767. format(msg, sizeof(msg), "*** %s has been spawned by Admin %s on IRC for reason: %s", name, user, reason);
  768. IRC_GroupSay(groupID, channel, msg);
  769. format(msg, sizeof(msg), "*** %s has been spawned by Admin %s on IRC for reason: %s", name, user, reason);
  770. SendClientMessageToAll(0xFF0000C8, msg);
  771. SpawnPlayer(playerid);
  772. }
  773. }
  774. return 1;
  775. }
  776. IRCCMD:forum(botid, channel[], user[], host[], params[])
  777. {
  778. new string29[128];
  779. new string30[128];
  780.  
  781. if (IRC_IsVoice(botid, channel, user))
  782. {
  783. format(string29, 128, "Sign up at our forums today! www.yourWEbhere.com");
  784. format(string30, 128, "Sign up at our forums today! www.yourWEBhere.com");
  785.  
  786. IRC_GroupSay(groupID, channel, string29);
  787.  
  788. SendClientMessageToAll(0x00E800C8, string30);
  789. }
  790. return 1;
  791. }
  792. IRCCMD:players( botid, channel[], user[], host[], params[] )
  793. {
  794. new tempstr[128], string[200], count, name[24];
  795. for( new i ,slots = GetMaxPlayers(); i < slots; i++ )
  796. {
  797. if(IsPlayerConnected(i))
  798. {
  799. count++;
  800. GetPlayerName(i, name, sizeof(name));
  801. format(tempstr, sizeof(tempstr), "%s , %s", tempstr, name);
  802. }
  803. }
  804. if(count)
  805. {
  806. format(string, sizeof(string), "Total Connected Players[%d/%d]:- %s", count, GetMaxPlayers(), tempstr);
  807. IRC_Say(botid, channel, string);
  808. } else IRC_Say(botid, channel, "No players are online :D.");
  809. return 1;
  810. }
  811.  
  812. IRCCMD:slap(botid, channel[], user[], host[], params[])
  813. {
  814. new playerid, reason[64];
  815. new player1;
  816.  
  817. if (sscanf(params, "dS(No reason.)[64]", playerid, reason))
  818. {
  819. return 1;
  820. }
  821. if (IRC_IsHalfop(botid, channel, user))
  822. {
  823. if(IsPlayerConnected(playerid))
  824. {
  825. new msg[128], name[MAX_PLAYER_NAME];
  826. GetPlayerName(playerid, name, sizeof(name));
  827. format(msg, sizeof(msg), "*** %s has been slapped by Admin %s on IRC for reason: %s", name, user, reason);
  828. IRC_GroupSay(groupID, channel, msg);
  829. format(msg, sizeof(msg), "*** %s has been slapped by Admin %s on IRC for reason: %s", name, user, reason);
  830. SendClientMessageToAll(0xFF0000C8, msg);
  831.  
  832. new Float:Health;
  833. new Float:x, Float:y, Float:z;
  834. GetPlayerHealth(player1,Health);
  835. SetPlayerHealth(player1,Health-25);
  836. GetPlayerPos(player1,x,y,z);
  837. SetPlayerPos(player1,x,y,z+7);
  838. PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
  839. PlayerPlaySound(player1,1190,0.0,0.0,0.0);
  840. }
  841. }
  842. return 1;
  843. }
  844. IRCCMD:freeze(botid, channel[], user[], host[], params[])
  845. {
  846. new playerid, reason[64];
  847.  
  848. if (sscanf(params, "dS(No reason.)[64]", playerid, reason))
  849. {
  850. return 1;
  851. }
  852. if (IRC_IsHalfop(botid, channel, user))
  853. {
  854. if(IsPlayerConnected(playerid))
  855. {
  856. new msg[128], name[MAX_PLAYER_NAME];
  857. GetPlayerName(playerid, name, sizeof(name));
  858. format(msg, sizeof(msg), "*** %s has been frozen by Staff Member %s on IRC for reason: %s", name, user, reason);
  859. IRC_GroupSay(groupID, channel, msg);
  860. format(msg, sizeof(msg), "*** %s has been frozen by Staff Member %s on IRC for reason: %s", name, user, reason);
  861. SendClientMessageToAll(0xFF0000C8, msg);
  862.  
  863. TogglePlayerControllable(playerid, 0);
  864.  
  865. }
  866. }
  867. return 1;
  868. }
  869.  
  870. IRCCMD:getinfo(botid, channel[], user[], host[], params[])
  871. {
  872. new playerid, pIP[128], Float:health, Float:armour;
  873.  
  874. if (sscanf(params, "d", playerid))
  875. {
  876. return 1;
  877. }
  878. if(IsPlayerConnected(playerid))
  879. {
  880. new msg[128], name[MAX_PLAYER_NAME];
  881. GetPlayerName(playerid, name, sizeof(name));
  882. GetPlayerIp(playerid, pIP, 128);
  883. GetPlayerHealth(playerid, health);
  884. GetPlayerArmour(playerid, armour);
  885. new ping;
  886. ping = GetPlayerPing(playerid);
  887. format(msg, sizeof(msg), "*** %s's info: IP: %s | Health: %d | Armour: %d | Ping: %d", name, pIP, floatround(health), floatround(armour), ping);
  888. IRC_GroupSay(groupID, channel, msg);
  889. }
  890. return 1;
  891. }
  892. IRCCMD:respawncars(botid, channel[], user[], host[], params[])
  893. {
  894. new string1[128], string2[128];
  895.  
  896. if (IRC_IsHalfop(botid, channel, user))
  897. {
  898. for(new i = 1; i <= MAX_VEHICLES; i++)
  899. {
  900. SetVehicleToRespawn(i);
  901. }
  902. format(string1, 128, " Admin %s has respawned all vehicles", user);
  903. format(string2, 128, "Admin %s has respawned all vehicles", user);
  904.  
  905. IRC_GroupSay(groupID, channel, string1);
  906. SendClientMessageToAll(0x00E800C8, string2);
  907. }
  908. return 1;
  909. }
  910. IRCCMD:pm(botid, channel[], user[], host[], params[])
  911. {
  912. if (IRC_IsVoice(botid, channel, user))
  913. {
  914. new playerid, reason[64];
  915. if (sscanf(params, "dz", playerid, reason))
  916. {
  917. return IRC_GroupSay(groupID,"channel","!pm <id> <message>");
  918. }
  919. if (IsPlayerConnected(playerid))
  920. {
  921. new msg[128], name[MAX_PLAYER_NAME];
  922. GetPlayerName(playerid, name, sizeof(name));
  923. format(msg, sizeof(msg), "02>> %s has sent a PM to %s from IRC: %s", user, name, reason);
  924. IRC_GroupSay(groupID, "channel", msg);
  925. format(msg, sizeof(msg), "012>> PM from %s on IRC: %s!", user, reason);
  926. SendClientMessage(playerid, 0xFF9900AA, msg);
  927. }
  928. else
  929. {
  930. return IRC_GroupSay(groupID,"channel","Wrong ID!");
  931. }
  932. }
  933. return 1;
  934. }
  935. IRCCMD:ann( botid, channel[], user[], host[], params[])
  936. {
  937. if(IRC_IsOp(botid,channel,user))
  938. {
  939. new text[128];
  940. if(sscanf(params,"s[120]",text)) return IRC_GroupNotice(groupID,user, "**Usage: !ann <text>");
  941. if( 0 > strlen(text) > 140 ) return IRC_GroupNotice(groupID,user,"** Message Size Invalid");
  942. new str[150];
  943. GameTextForAll(text,7600,3);
  944. format(str,64,"->Admin (%s) Announced: %s",text);
  945. IRC_GroupSay(groupID,"#Xoomer",str);
  946. }
  947. return 1;
  948. }
  949. IRCCMD:admin(botid, channel[], user[], host[], params[])
  950. {
  951. // Check if the user has at least voice in the channel
  952. if (IRC_IsOp(botid, channel, user))
  953. {
  954. // Check if the user entered any text
  955. if (!isnull(params))
  956. {
  957. new msg[128];
  958. // Echo the formatted message
  959. format(msg, sizeof(msg), "02***Admin %s on IRC: %s", user, params);
  960. IRC_GroupSay(groupID, "#Sx", msg);
  961. format(msg, sizeof(msg), "***Admin %s on IRC: %s", user, params);
  962. SendClientMessageToAll(0x15005EAA, msg);
  963. }
  964. }
  965. return 1;
  966. }
  967. IRCCMD:announce( botid, channel[], user[], host[], params[])
  968. {
  969. if(IRC_IsOp(botid,channel,user))
  970. {
  971. new text[128];
  972. if(sscanf(params,"s[120]",text)) return IRC_GroupNotice(groupID,user, "**Usage: !ann <text>");
  973. if( 0 > strlen(text) > 140 ) return IRC_GroupNotice(groupID,user,"** Message Size Invalid");
  974. new str[150];
  975. GameTextForAll(text,7600,3);
  976. format(str,64,"->Admin (%s) Announced: %s",text);
  977. IRC_GroupSay(groupID,"#Xoomer",str);
  978. }
  979. return 1;
  980. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement