Guest User

Xoom-IRC

a guest
Mar 16th, 2013
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.68 KB | None | 0 0
  1. /*this irc script made by Xoomer
  2. Dont remove credits */
  3.  
  4.  
  5.  
  6. #include <a_samp>
  7. // irc.inc from this package
  8. #include <irc>
  9. // sscanf2.inc from the sscanf plugin
  10. #include <sscanf2>
  11.  
  12. // Name that everyone will see
  13. #define BOT_1_NICKNAME "GamerZZ"
  14. // Name that will only be visible in a whois
  15. #define BOT_1_REALNAME "Xoomer"
  16. // Name that will be in front of the hostname (username@hostname)
  17. #define BOT_1_USERNAME "Xoomer"
  18.  
  19. #define BOT_2_NICKNAME "GamerZX"
  20. #define BOT_2_REALNAME "Xoomer"
  21. #define BOT_2_USERNAME "Xoomer"
  22.  
  23. #define IRC_SERVER "IRC SERVER"
  24. #define IRC_PORT 6667
  25. #define IRC_CHANNEL "#channel"
  26. #define BotPass "123"
  27. // Maximum number of bots in the filterscript
  28. #define MAX_BOTS (2)
  29. #define MAX_WARNINGS 3
  30. #define PLUGIN_VERSION "1.4.3"
  31.  
  32. new botIDs[MAX_BOTS], groupID;
  33. new Warns[MAX_PLAYERS];
  34. stock FlipVehicle(playerid)
  35. {
  36. new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle;
  37. GetPlayerPos(playerid, X, Y, Z);
  38. VehicleID = GetPlayerVehicleID(playerid);
  39. GetVehicleZAngle(VehicleID, Angle);
  40. SetVehiclePos(VehicleID, X, Y, Z);
  41. SetVehicleZAngle(VehicleID, Angle);
  42. }
  43. /*
  44. When the filterscript is loaded, two bots will connect and a group will be
  45. created for them.
  46. */
  47.  
  48. public OnFilterScriptInit()
  49. {
  50. // Connect the first bot
  51. botIDs[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
  52. // Set the connect delay for the first bot to 20 seconds
  53. IRC_SetIntData(botIDs[0], E_IRC_CONNECT_DELAY, 20);
  54. // Connect the second bot
  55. botIDs[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
  56. // Set the connect delay for the second bot to 30 seconds
  57. IRC_SetIntData(botIDs[1], E_IRC_CONNECT_DELAY, 30);
  58. // Create a group (the bots will be added to it upon connect)
  59. groupID = IRC_CreateGroup();
  60. }
  61.  
  62. /*
  63. When the filterscript is unloaded, the bots will disconnect, and the group
  64. will be destroyed.
  65. */
  66.  
  67. public OnFilterScriptExit()
  68. {
  69. // Disconnect the first bot
  70. IRC_Quit(botIDs[0], "Filterscript exiting");
  71. // Disconnect the second bot
  72. IRC_Quit(botIDs[1], "Filterscript exiting");
  73. // Destroy the group
  74. IRC_DestroyGroup(groupID);
  75. }
  76.  
  77. /*
  78. The standard SA-MP callbacks are below. We will echo a few of them to the
  79. IRC channel.
  80. */
  81.  
  82. public OnPlayerConnect(playerid)
  83. {
  84. new joinMsg[128], name[MAX_PLAYER_NAME];
  85. GetPlayerName(playerid, name, sizeof(name));
  86. format(joinMsg, sizeof(joinMsg), "02[%d] 03*** %s has joined the server.", playerid, name);
  87. IRC_GroupSay(groupID, IRC_CHANNEL, joinMsg);
  88. Warns[playerid] = 0;
  89. return 1;
  90. }
  91.  
  92. public OnPlayerDisconnect(playerid, reason)
  93. {
  94. new leaveMsg[128], name[MAX_PLAYER_NAME], reasonMsg[8];
  95. switch(reason)
  96. {
  97. case 0: reasonMsg = "Timeout";
  98. case 1: reasonMsg = "Leaving";
  99. case 2: reasonMsg = "Kicked";
  100. }
  101. Warns[playerid] = 0;
  102. GetPlayerName(playerid, name, sizeof(name));
  103. format(leaveMsg, sizeof(leaveMsg), "02[%d] 03*** %s has left the server. (%s)", playerid, name, reasonMsg);
  104. IRC_GroupSay(groupID, IRC_CHANNEL, leaveMsg);
  105. return 1;
  106. }
  107.  
  108. public OnPlayerDeath(playerid, killerid, reason)
  109. {
  110. new msg[128], killerName[MAX_PLAYER_NAME], reasonMsg[32], playerName[MAX_PLAYER_NAME];
  111. GetPlayerName(killerid, killerName, sizeof(killerName));
  112. GetPlayerName(playerid, playerName, sizeof(playerName));
  113. if (killerid != INVALID_PLAYER_ID)
  114. {
  115. switch (reason)
  116. {
  117. case 0: reasonMsg = "Unarmed";
  118. case 1: reasonMsg = "Brass Knuckles";
  119. case 2: reasonMsg = "Golf Club";
  120. case 3: reasonMsg = "Night Stick";
  121. case 4: reasonMsg = "Knife";
  122. case 5: reasonMsg = "Baseball Bat";
  123. case 6: reasonMsg = "Shovel";
  124. case 7: reasonMsg = "Pool Cue";
  125. case 8: reasonMsg = "Katana";
  126. case 9: reasonMsg = "Chainsaw";
  127. case 10: reasonMsg = "Dildo";
  128. case 11: reasonMsg = "Dildo";
  129. case 12: reasonMsg = "Vibrator";
  130. case 13: reasonMsg = "Vibrator";
  131. case 14: reasonMsg = "Flowers";
  132. case 15: reasonMsg = "Cane";
  133. case 22: reasonMsg = "Pistol";
  134. case 23: reasonMsg = "Silenced Pistol";
  135. case 24: reasonMsg = "Desert Eagle";
  136. case 25: reasonMsg = "Shotgun";
  137. case 26: reasonMsg = "Sawn-off Shotgun";
  138. case 27: reasonMsg = "Combat Shotgun";
  139. case 28: reasonMsg = "MAC-10";
  140. case 29: reasonMsg = "MP5";
  141. case 30: reasonMsg = "AK-47";
  142. case 31: reasonMsg = "M4";
  143. case 32: reasonMsg = "TEC-9";
  144. case 33: reasonMsg = "Country Rifle";
  145. case 34: reasonMsg = "Sniper Rifle";
  146. case 37: reasonMsg = "Fire";
  147. case 38: reasonMsg = "Minigun";
  148. case 41: reasonMsg = "Spray Can";
  149. case 42: reasonMsg = "Fire Extinguisher";
  150. case 49: reasonMsg = "Vehicle Collision";
  151. case 50: reasonMsg = "Vehicle Collision";
  152. case 51: reasonMsg = "Explosion";
  153. default: reasonMsg = "Unknown";
  154. }
  155. format(msg, sizeof(msg), "04*** %s killed %s. (%s)", killerName, playerName, reasonMsg);
  156. }
  157. else
  158. {
  159. switch (reason)
  160. {
  161. case 53: format(msg, sizeof(msg), "04*** %s died. (Drowned)", playerName);
  162. case 54: format(msg, sizeof(msg), "04*** %s died. (Collision)", playerName);
  163. default: format(msg, sizeof(msg), "04*** %s died.", playerName);
  164. }
  165. }
  166. IRC_GroupSay(groupID, IRC_CHANNEL, msg);
  167. return 1;
  168. }
  169.  
  170. public OnPlayerText(playerid, text[])
  171. {
  172. new name[MAX_PLAYER_NAME], ircMsg[256];
  173. GetPlayerName(playerid, name, sizeof(name));
  174. format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, name, text);
  175. IRC_GroupSay(groupID, IRC_CHANNEL, ircMsg);
  176. return 1;
  177. }
  178.  
  179. /*
  180. The IRC callbacks are below. Many of these are simply derived from parsed
  181. raw messages received from the IRC server. They can be used to inform the
  182. bot of new activity in any of the channels it has joined.
  183. */
  184.  
  185. /*
  186. This callback is executed whenever a bot successfully connects to an IRC
  187. server.
  188. */
  189.  
  190. public IRC_OnConnect(botid, ip[], port)
  191. {
  192. printf("*** IRC_OnConnect: Bot ID %d connected to %s:%d", botid, ip, port);
  193. // Join the channel
  194. IRC_JoinChannel(botid, IRC_CHANNEL);
  195. // Add the bot to the group
  196. IRC_AddToGroup(groupID, botid);
  197. return 1;
  198. }
  199.  
  200. /*
  201. This callback is executed whenever a current connection is closed. The
  202. plugin may automatically attempt to reconnect per user settings. IRC_Quit
  203. may be called at any time to stop the reconnection process.
  204. */
  205.  
  206. public IRC_OnDisconnect(botid, ip[], port, reason[])
  207. {
  208. printf("*** IRC_OnDisconnect: Bot ID %d disconnected from %s:%d (%s)", botid, ip, port, reason);
  209. // Remove the bot from the group
  210. IRC_RemoveFromGroup(groupID, botid);
  211. return 1;
  212. }
  213.  
  214. /*
  215. This callback is executed whenever a connection attempt begins. IRC_Quit may
  216. be called at any time to stop the reconnection process.
  217. */
  218.  
  219. public IRC_OnConnectAttempt(botid, ip[], port)
  220. {
  221. printf("*** IRC_OnConnectAttempt: Bot ID %d attempting to connect to %s:%d...", botid, ip, port);
  222. return 1;
  223. }
  224.  
  225. /*
  226. This callback is executed whenever a connection attempt fails. IRC_Quit may
  227. be called at any time to stop the reconnection process.
  228. */
  229.  
  230. public IRC_OnConnectAttemptFail(botid, ip[], port, reason[])
  231. {
  232. printf("*** IRC_OnConnectAttemptFail: Bot ID %d failed to connect to %s:%d (%s)", botid, ip, port, reason);
  233. return 1;
  234. }
  235.  
  236. /*
  237. This callback is executed whenever a bot joins a channel.
  238. */
  239.  
  240. public IRC_OnJoinChannel(botid, channel[])
  241. {
  242. printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s", botid, channel);
  243. return 1;
  244. }
  245.  
  246. /*
  247. This callback is executed whenevever a bot leaves a channel.
  248. */
  249.  
  250. public IRC_OnLeaveChannel(botid, channel[], message[])
  251. {
  252. printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)", botid, channel, message);
  253. return 1;
  254. }
  255.  
  256. /*
  257. This callback is executed whenevever a bot is invited to a channel.
  258. */
  259.  
  260. public IRC_OnInvitedToChannel(botid, channel[], invitinguser[], invitinghost[])
  261. {
  262. printf("*** IRC_OnInvitedToChannel: Bot ID %d invited to channel %s by %s (%s)", botid, channel, invitinguser, invitinghost);
  263. IRC_JoinChannel(botid, channel);
  264. return 1;
  265. }
  266.  
  267. /*
  268. This callback is executed whenevever a bot is kicked from a channel. If the
  269. bot cannot immediately rejoin the channel (in the event, for example, that
  270. the bot is kicked and then banned), you might want to set up a timer here
  271. for rejoin attempts.
  272. */
  273.  
  274. public IRC_OnKickedFromChannel(botid, channel[], oppeduser[], oppedhost[], message[])
  275. {
  276. printf("*** IRC_OnKickedFromChannel: Bot ID %d kicked by %s (%s) from channel %s (%s)", botid, oppeduser, oppedhost, channel, message);
  277. IRC_JoinChannel(botid, channel);
  278. return 1;
  279. }
  280.  
  281. public IRC_OnUserDisconnect(botid, user[], host[], message[])
  282. {
  283. printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected (%s)", botid, user, host, message);
  284. return 1;
  285. }
  286.  
  287. public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
  288. {
  289. printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s", botid, user, host, channel);
  290. IRC_IsVoice(botid, IRC_CHANNEL, "+v");
  291. return 1;
  292. }
  293.  
  294. public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
  295. {
  296. printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)", botid, user, host, channel, message);
  297. return 1;
  298. }
  299.  
  300. public IRC_OnUserKickedFromChannel(botid, channel[], kickeduser[], oppeduser[], oppedhost[], message[])
  301. {
  302. printf("*** IRC_OnUserKickedFromChannel (Bot ID %d): User %s kicked by %s (%s) from channel %s (%s)", botid, kickeduser, oppeduser, oppedhost, channel, message);
  303. }
  304.  
  305. public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
  306. {
  307. printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his/her nick to %s", botid, oldnick, host, newnick);
  308. return 1;
  309. }
  310.  
  311. public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
  312. {
  313. printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s", botid, user, host, channel, mode);
  314. if(IRC_IsOp(botid, IRC_CHANNEL, user))
  315. {
  316. IRC_IsVoice(botid, IRC_CHANNEL, "+v");
  317. return 1;
  318. }
  319. return 1;
  320. }
  321.  
  322. public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
  323. {
  324. printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s", botid, user, host, channel, topic);
  325. return 1;
  326. }
  327.  
  328. public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
  329. {
  330. printf("*** IRC_OnUserSay (Bot ID %d): User %s (%s) sent message to %s: %s", botid, user, host, recipient, message);
  331. // Someone sent the first bot a private message
  332. if (!strcmp(recipient, BOT_1_NICKNAME))
  333. {
  334. IRC_Say(botid, user, "You sent me a PM!");
  335. }
  336. return 1;
  337. }
  338.  
  339. public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
  340. {
  341. printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
  342. // Someone sent the second bot a notice (probably a network service)
  343. if (!strcmp(recipient, BOT_2_NICKNAME))
  344. {
  345. IRC_Notice(botid, user, "You sent me a notice!");
  346. }
  347. return 1;
  348. }
  349.  
  350. public IRC_OnUserRequestCTCP(botid, user[], host[], message[])
  351. {
  352. printf("*** IRC_OnUserRequestCTCP (Bot ID %d): User %s (%s) sent CTCP request: %s", botid, user, host, message);
  353. // Someone sent a CTCP VERSION request
  354. if (!strcmp(message, "VERSION"))
  355. {
  356. IRC_ReplyCTCP(botid, user, "VERSION SA-MP IRC Plugin v" #PLUGIN_VERSION "");
  357. }
  358. return 1;
  359. }
  360.  
  361. public IRC_OnUserReplyCTCP(botid, user[], host[], message[])
  362. {
  363. printf("*** IRC_OnUserReplyCTCP (Bot ID %d): User %s (%s) sent CTCP reply: %s", botid, user, host, message);
  364. return 1;
  365. }
  366.  
  367. /*
  368. This callback is useful for logging, debugging, or catching error messages
  369. sent by the IRC server.
  370. */
  371.  
  372. public IRC_OnReceiveRaw(botid, message[])
  373. {
  374. new File:file;
  375. if (!fexist("irc_log.txt"))
  376. {
  377. file = fopen("irc_log.txt", io_write);
  378. }
  379. else
  380. {
  381. file = fopen("irc_log.txt", io_append);
  382. }
  383. if (file)
  384. {
  385. fwrite(file, message);
  386. fwrite(file, "\r\n");
  387. fclose(file);
  388. }
  389. return 1;
  390. }
  391.  
  392. /*
  393. Some examples of channel commands are here. You can add more very easily;
  394. their implementation is identical to that of ZeeX's zcmd.
  395. */
  396.  
  397. IRCCMD:say(botid, channel[], user[], host[], params[])
  398. {
  399. // Check if the user has at least voice in the channel
  400. if (IRC_IsVoice(botid, channel, user))
  401. {
  402. // Check if the user entered any text
  403. if (!isnull(params))
  404. {
  405. new msg[128];
  406. // Echo the formatted message
  407. format(msg, sizeof(msg), "02*** %s on IRC: %s", user, params);
  408. IRC_GroupSay(groupID, channel, msg);
  409. format(msg, sizeof(msg), "{FFFFFF}*** %s on IRC: %s", user, params);
  410. SendClientMessageToAll(0xFFFFFFFF, msg);
  411. }
  412. }
  413. return 1;
  414. }
  415. IRCCMD:warn(botid, channel[], user[], host[], params[])
  416. {
  417. // Check if the user is at least a halfop in the channel
  418. if (IRC_IsOp(botid, channel, user))
  419. {
  420. new playerid, reason[64];
  421. // Check if the user at least entered a player ID
  422. if (sscanf(params, "dS(No reason)[64]", playerid, reason)) return IRC_GroupSay(groupID, channel, "Syntax: !warn playerid reason");
  423. // Check if the player is connected
  424. if (IsPlayerConnected(playerid))
  425. {
  426. // warns the player
  427. // Echo the formatted message
  428.  
  429. new msg[128], name[MAX_PLAYER_NAME];
  430. Warns[playerid]++;
  431. GetPlayerName(playerid, name, sizeof(name));
  432. format(msg, sizeof(msg), "02*** %s has been warned by %s on IRC.(warning: %d/3) (Reason: %s)", name, user, Warns[playerid],reason);
  433. IRC_GroupSay(groupID, channel, msg);
  434. format(msg, sizeof(msg), "*** %s has been warned by %s on IRC.(warning: %d/3) (Reason: %s)", name, user, Warns[playerid],reason);
  435. SendClientMessageToAll(0x0000FFFF, msg);
  436.  
  437. if(Warns[playerid] == MAX_WARNINGS)
  438. {
  439. GetPlayerName(playerid, name, sizeof(name));
  440. format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. reason: warning 3/3", name, user);
  441. IRC_GroupSay(groupID, channel, msg);
  442. format(msg, sizeof(msg), "*** %s has been warned by %s on IRC. reason: warning 3/3", name, user);
  443. SendClientMessageToAll(0x0000FFFF, msg);
  444. Kick(playerid);
  445. }
  446. }
  447. }
  448. return 1;
  449. }
  450. IRCCMD:repair(botid, channel[], user[], host[], params[])
  451. {
  452. // Check if the user is at least a halfop in the channel
  453. if (IRC_IsOp(botid, channel, user))
  454. {
  455. new playerid;
  456. // Check if the user at least entered a player ID
  457. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !repair playerid");
  458. // Check if the player is connected
  459. if (IsPlayerConnected(playerid))
  460. {
  461. // warns the player
  462. // Echo the formatted message
  463. if(IsPlayerInAnyVehicle(playerid))
  464. {
  465. new msg[128], name[MAX_PLAYER_NAME];
  466. Warns[playerid]++;
  467. GetPlayerName(playerid, name, sizeof(name));
  468. format(msg, sizeof(msg), "02***IRC Admin %s : has repaired %s's vehicle .", user, name);
  469. IRC_GroupSay(groupID, channel, msg);
  470. format(msg, sizeof(msg), "*** IRC Admin %s : has repaired %s's vehicle .", user, name);
  471. SendClientMessageToAll(0x0000FFFF, msg);
  472. RepairVehicle(playerid);
  473. }
  474. else return IRC_GroupSay(groupID, channel, "This player isn't in a vehicle");
  475. }
  476. }
  477. return 1;
  478. }
  479. IRCCMD:fix(botid, channel[], user[], host[], params[])
  480. {
  481. // Check if the user is at least a halfop in the channel
  482. if (IRC_IsOp(botid, channel, user))
  483. {
  484. new playerid;
  485. // Check if the user at least entered a player ID
  486. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !repair playerid");
  487. // Check if the player is connected
  488. if (IsPlayerConnected(playerid))
  489. {
  490. // warns the player
  491. // Echo the formatted message
  492. if(IsPlayerInAnyVehicle(playerid))
  493. {
  494. new msg[128], name[MAX_PLAYER_NAME];
  495. Warns[playerid]++;
  496. GetPlayerName(playerid, name, sizeof(name));
  497. format(msg, sizeof(msg), "02*** %s has repaired %s's vehicle on IRC.", user, name);
  498. IRC_GroupSay(groupID, channel, msg);
  499. format(msg, sizeof(msg), "*** %s has repaired %s's vehicle on IRC.", user, name);
  500. SendClientMessageToAll(0x0000FFFF, msg);
  501. RepairVehicle(playerid);
  502. }
  503. else return IRC_GroupSay(groupID, channel, "This player isn't in a vehicle");
  504. }
  505. }
  506. return 1;
  507. }
  508. IRCCMD:flip(botid, channel[], user[], host[], params[])
  509. {
  510. // Check if the user is at least a halfop in the channel
  511. if (IRC_IsOp(botid, channel, user))
  512. {
  513. new playerid;
  514. // Check if the user at least entered a player ID
  515. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !flip playerid");
  516. // Check if the player is connected
  517. if (IsPlayerConnected(playerid))
  518. {
  519. // warns the player
  520. // Echo the formatted message
  521. if(IsPlayerInAnyVehicle(playerid))
  522. {
  523. new msg[128], name[MAX_PLAYER_NAME];
  524. Warns[playerid]++;
  525. GetPlayerName(playerid, name, sizeof(name));
  526. format(msg, sizeof(msg), "02*** %s has flipped %s's vehicle on IRC.", user, name);
  527. IRC_GroupSay(groupID, channel, msg);
  528. format(msg, sizeof(msg), "*** %s has flipped %s's vehicle on IRC.", user, name);
  529. SendClientMessageToAll(0x0000FFFF, msg);
  530. FlipVehicle(playerid);
  531. }
  532. else return IRC_GroupSay(groupID, channel, "This player isn't in a vehicle");
  533. }
  534. }
  535. return 1;
  536. }
  537. IRCCMD:givecar(botid, channel[], user[], host[], params[])
  538. {
  539. // Check if the user is at least a halfop in the channel
  540. if (IRC_IsOp(botid, channel, user))
  541. {
  542. new playerid;
  543. // Check if the user at least entered a player ID
  544. if (sscanf(params, "d", playerid)) return IRC_GroupSay(groupID, channel, "Syntax: !givecar playerid");
  545. // Check if the player is connected
  546. if (IsPlayerConnected(playerid))
  547. {
  548. // warns the player
  549. // Echo the formatted message
  550. if(!IsPlayerInAnyVehicle(playerid))
  551. {
  552. new msg[128], name[MAX_PLAYER_NAME];
  553. Warns[playerid]++;
  554. GetPlayerName(playerid, name, sizeof(name));
  555. format(msg, sizeof(msg), "02*** %s has given %s a car on IRC.", user, name);
  556. IRC_GroupSay(groupID, channel, msg);
  557. format(msg, sizeof(msg), "*** %s has given %s a car on IRC.", user, name);
  558. SendClientMessageToAll(0x0000FFFF, msg);
  559. new Float:x, Float:y, Float:z, Float:a;
  560. GetPlayerPos(playerid, x, y, z);
  561. GetPlayerFacingAngle(playerid, a);
  562. PutPlayerInVehicle(playerid, CreateVehicle(411, x, y, z, a, -1, -1, 50), 0);
  563. SendClientMessage(playerid, 0x00FF00FF, "Enjoy your new car");
  564. }
  565. else return IRC_GroupSay(groupID, channel, "this player already has a Vehicle");
  566. }
  567. }
  568. return 1;
  569. }
  570. IRCCMD:kick(botid, channel[], user[], host[], params[])
  571. {
  572. // Check if the user is at least a halfop in the channel
  573. if (IRC_IsHalfop(botid, channel, user))
  574. {
  575. new playerid, reason[64];
  576. // Check if the user at least entered a player ID
  577. if (sscanf(params, "dS(No reason)[64]", playerid, reason)) return IRC_GroupSay(groupID, channel, "Syntax: !kick playerid reason");
  578. // Check if the player is connected
  579. if (IsPlayerConnected(playerid))
  580. {
  581. // Echo the formatted message
  582. new msg[128], name[MAX_PLAYER_NAME];
  583. GetPlayerName(playerid, name, sizeof(name));
  584. format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
  585. IRC_GroupSay(groupID, channel, msg);
  586. format(msg, sizeof(msg), "*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
  587. SendClientMessageToAll(0x0000FFFF, msg);
  588. // Kick the player
  589. Kick(playerid);
  590. }
  591. }
  592. return 1;
  593. }
  594.  
  595. IRCCMD:ban(botid, channel[], user[], host[], params[])
  596. {
  597. // Check if the user is at least an op in the channel
  598. if (IRC_IsOp(botid, channel, user))
  599. {
  600. new playerid, reason[64];
  601. // Check if the user at least entered a player ID
  602. if (sscanf(params, "dS(No reason)[64]", playerid, reason)) return IRC_GroupSay(groupID, channel, "Syntax: !ban playerid reason");
  603. // Check if the player is connected
  604. if (IsPlayerConnected(playerid))
  605. {
  606. // Echo the formatted message
  607. new msg[128], name[MAX_PLAYER_NAME];
  608. GetPlayerName(playerid, name, sizeof(name));
  609. format(msg, sizeof(msg), "02*** %s has been banned by %s on IRC. (%s)", name, user, reason);
  610. IRC_GroupSay(groupID, channel, msg);
  611. format(msg, sizeof(msg), "*** %s has been banned by %s on IRC. (%s)", name, user, reason);
  612. SendClientMessageToAll(0x0000FFFF, msg);
  613. // Ban the player
  614. BanEx(playerid, reason);
  615. }
  616. }
  617. return 1;
  618. }
  619.  
  620. IRCCMD:rcon(botid, channel[], user[], host[], params[])
  621. {
  622. // Check if the user is at least an op in the channel
  623. if (IRC_IsOp(botid, channel, user))
  624. {
  625. // Check if the user entered any text
  626. if (!isnull(params))
  627. {
  628. // Check if the user did not enter any invalid commands
  629. if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
  630. {
  631. // Echo the formatted message
  632. new msg[128];
  633. format(msg, sizeof(msg), "RCON command %s has been executed.", params);
  634. IRC_GroupSay(groupID, channel, msg);
  635. // Send the command
  636. SendRconCommand(params);
  637. }
  638. }
  639. }
  640. return 1;
  641. }
  642.  
  643. IRCCMD:cmds(botid, channel[], user[], host[], params[])
  644. {
  645. IRC_GroupSay(groupID,"#channel","IRC COMMANDS");
  646. IRC_GroupSay(groupID,"#channel","Players CMDS :::!say !getname !players !forum)we will add more cmds soon");
  647. IRC_GroupSay(groupID,"#channel","!Flip !respawncars !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. }
Advertisement
Add Comment
Please, Sign In to add comment