Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Porsche911's IRC PAWN Script!
- #include <a_samp>
- #include <irc>
- // Name that everyone will see
- #define BOT_1_NICKNAME "BotA"
- // Name that will only be visible in a whois
- #define BOT_1_REALNAME "SA-MP Bot"
- // Name that will be in front of the hostname (username@hostname)
- #define BOT_1_USERNAME "bot"
- #define BOT_2_NICKNAME "BotB"
- #define BOT_2_REALNAME "SA-MP Bot"
- #define BOT_2_USERNAME "bot"
- #define IRC_SERVER "irc.foco.co" // EDIT IT to your irc server
- #define IRC_PORT (6667) // Leave THE port
- #define IRC_CHANNEL "#Samp4Ever" // Set it to your IRC Channel!
- #define blue 0x375FFFFF
- #define red 0xFF0000AA
- #define green 0x33FF33AA
- #define ROJO 0x33FF33AA
- #define yellow 0xFFFF00AA
- #define grey 0xC0C0C0AA
- #define blue1 0x2641FEAA
- #define lightblue 0x33CCFFAA
- #define orange 0xFF9900AA
- #define black 0x2C2727AA
- #pragma tabsize 0
- // Maximum number of bots in the filterscript
- #define MAX_BOTS (2)
- new
- gBotID[MAX_BOTS],
- gGroupID;
- /*
- When the filterscript is loaded, two bots will connect and a group will be
- created for them.
- */
- public
- OnFilterScriptInit()
- {
- // Wait 5 seconds for the first bot
- SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);
- // Wait 10 seconds for the second bot
- SetTimerEx("IRC_ConnectDelay", 10000, 0, "d", 2);
- // Create a group (the bots will be added to it upon connect)
- gGroupID = IRC_CreateGroup();
- }
- /*
- When the filterscript is unloaded, the bots will disconnect, and the group
- will be destroyed.
- */
- public
- OnFilterScriptExit()
- {
- // Disconnect the first bot
- IRC_Quit(gBotID[0], "Filterscript exiting");
- // Disconnect the second bot
- IRC_Quit(gBotID[1], "Filterscript exiting");
- // Destroy the group
- IRC_DestroyGroup(gGroupID);
- }
- /*
- This function is called on a timer in order to delay connections to the IRC
- server and effectively prevent join floods.
- */
- forward
- IRC_ConnectDelay(tempid);
- public
- IRC_ConnectDelay(tempid)
- {
- switch (tempid)
- {
- case 1:
- {
- // Connect the first bot
- gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME);
- }
- case 2:
- {
- // Connect the second bot
- gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME);
- }
- }
- return 1;
- }
- /*
- The standard SA-MP callbacks are below. We will echo a few of them to the
- IRC channel.
- */
- public
- OnPlayerConnect(playerid)
- {
- new
- joinMsg[128],
- name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(joinMsg, sizeof(joinMsg), "02[%d] 03*** %s has joined the server.", playerid, name);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, joinMsg);
- return 1;
- }
- public
- OnPlayerDisconnect(playerid, reason)
- {
- new
- leaveMsg[128],
- name[MAX_PLAYER_NAME],
- reasonMsg[8];
- switch(reason)
- {
- case 0:
- {
- reasonMsg = "Timeout";
- }
- case 1:
- {
- reasonMsg = "Leaving";
- }
- case 2:
- {
- reasonMsg = "Kicked";
- }
- }
- GetPlayerName(playerid, name, sizeof(name));
- format(leaveMsg, sizeof(leaveMsg), "02[%d] 03*** %s has left the server. (%s)", playerid, name, reasonMsg);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, leaveMsg);
- return 1;
- }
- /*
- Here is an extensive list of death reasons that I compiled some time ago. It
- correctly reports all types of kills, including those made in some vehicles.
- */
- public
- OnPlayerDeath(playerid, killerid, reason)
- {
- new
- msg[128],
- killerName[MAX_PLAYER_NAME],
- reasonMsg[32],
- playerName[MAX_PLAYER_NAME];
- GetPlayerName(killerid, killerName, sizeof(killerName));
- GetPlayerName(playerid, playerName, sizeof(playerName));
- if (killerid != INVALID_PLAYER_ID)
- {
- switch (reason)
- {
- case 0:
- {
- reasonMsg = "Unarmed";
- }
- case 1:
- {
- reasonMsg = "Brass Knuckles";
- }
- case 2:
- {
- reasonMsg = "Golf Club";
- }
- case 3:
- {
- reasonMsg = "Night Stick";
- }
- case 4:
- {
- reasonMsg = "Knife";
- }
- case 5:
- {
- reasonMsg = "Baseball Bat";
- }
- case 6:
- {
- reasonMsg = "Shovel";
- }
- case 7:
- {
- reasonMsg = "Pool Cue";
- }
- case 8:
- {
- reasonMsg = "Katana";
- }
- case 9:
- {
- reasonMsg = "Chainsaw";
- }
- case 10:
- {
- reasonMsg = "Dildo";
- }
- case 11:
- {
- reasonMsg = "Dildo";
- }
- case 12:
- {
- reasonMsg = "Vibrator";
- }
- case 13:
- {
- reasonMsg = "Vibrator";
- }
- case 14:
- {
- reasonMsg = "Flowers";
- }
- case 15:
- {
- reasonMsg = "Cane";
- }
- case 22:
- {
- reasonMsg = "Pistol";
- }
- case 23:
- {
- reasonMsg = "Silenced Pistol";
- }
- case 24:
- {
- reasonMsg = "Desert Eagle";
- }
- case 25:
- {
- reasonMsg = "Shotgun";
- }
- case 26:
- {
- reasonMsg = "Sawn-off Shotgun";
- }
- case 27:
- {
- reasonMsg = "Combat Shotgun";
- }
- case 28:
- {
- reasonMsg = "MAC-10";
- }
- case 29:
- {
- reasonMsg = "MP5";
- }
- case 30:
- {
- reasonMsg = "AK-47";
- }
- case 31:
- {
- if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
- {
- switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
- {
- case 447:
- {
- reasonMsg = "Sea Sparrow Machine Gun";
- }
- default:
- {
- reasonMsg = "M4";
- }
- }
- }
- else
- {
- reasonMsg = "M4";
- }
- }
- case 32:
- {
- reasonMsg = "TEC-9";
- }
- case 33:
- {
- reasonMsg = "Rifle";
- }
- case 34:
- {
- reasonMsg = "Sniper Rifle";
- }
- case 37:
- {
- reasonMsg = "Fire";
- }
- case 38:
- {
- if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
- {
- switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
- {
- case 425:
- {
- reasonMsg = "Hunter Machine Gun";
- }
- default:
- {
- reasonMsg = "Minigun";
- }
- }
- }
- else
- {
- reasonMsg = "Minigun";
- }
- }
- case 41:
- {
- reasonMsg = "Spraycan";
- }
- case 42:
- {
- reasonMsg = "Fire Extinguisher";
- }
- case 49:
- {
- reasonMsg = "Vehicle Collision";
- }
- case 50:
- {
- if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
- {
- switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
- {
- case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563:
- {
- reasonMsg = "Helicopter Blades";
- }
- default:
- {
- reasonMsg = "Vehicle Collision";
- }
- }
- }
- else
- {
- reasonMsg = "Vehicle Collision";
- }
- }
- case 51:
- {
- if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
- {
- switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
- {
- case 425:
- {
- reasonMsg = "Hunter Rockets";
- }
- case 432:
- {
- reasonMsg = "Rhino Turret";
- }
- case 520:
- {
- reasonMsg = "Hydra Rockets";
- }
- default:
- {
- reasonMsg = "Explosion";
- }
- }
- }
- else
- {
- reasonMsg = "Explosion";
- }
- }
- default:
- {
- reasonMsg = "Unknown";
- }
- }
- format(msg, sizeof(msg), "04*** %s killed %s. (%s)", killerName, playerName, reasonMsg);
- }
- else
- {
- switch (reason)
- {
- case 53:
- {
- format(msg, sizeof(msg), "04*** %s died. (Drowned)", playerName);
- }
- case 54:
- {
- format(msg, sizeof(msg), "04*** %s died. (Collision)", playerName);
- }
- default:
- {
- format(msg, sizeof(msg), "04*** %s died.", playerName);
- }
- }
- }
- IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
- return 1;
- }
- public
- OnPlayerText(playerid, text[])
- {
- new
- name[MAX_PLAYER_NAME],
- ircMsg[256];
- GetPlayerName(playerid, name, sizeof(name));
- format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, name, text);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, ircMsg);
- return 1;
- }
- /*
- The IRC callbacks are below. Many of these are simply derived from parsed
- raw messages received from the IRC server. They can be used to inform the
- bot of new activity in any of the channels it has joined.
- */
- public
- IRC_OnConnect(botid)
- {
- printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
- // Join the channel
- IRC_JoinChannel(botid, IRC_CHANNEL);
- // Add the bot to the group
- IRC_AddToGroup(gGroupID, botid);
- return 1;
- }
- /*
- Note that this callback is executed whenever a current connection is closed
- OR whenever a connection attempt fails. Reconnecting too fast can flood the
- IRC server and possibly result in a ban. It is recommended to set up
- connection reattempts on a timer, as demonstrated here.
- */
- public
- IRC_OnDisconnect(botid)
- {
- printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
- if (botid == gBotID[0])
- {
- // Reset the bot ID
- gBotID[0] = 0;
- // Wait 20 seconds for the first bot
- SetTimerEx("IRC_ConnectDelay", 20000, 0, "d", 1);
- }
- else if (botid == gBotID[1])
- {
- // Reset the bot ID
- gBotID[1] = 0;
- // Wait 25 seconds for the second bot
- SetTimerEx("IRC_ConnectDelay", 25000, 0, "d", 2);
- }
- printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
- // Remove the bot from the group
- IRC_RemoveFromGroup(gGroupID, botid);
- return 1;
- }
- public
- IRC_OnJoinChannel(botid, channel[])
- {
- printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
- return 1;
- }
- /*
- If the bot cannot immediately rejoin the channel (in the event, for example,
- that the bot is kicked and then banned), you might want to set up a timer
- here as well for rejoin attempts.
- */
- public
- IRC_OnLeaveChannel(botid, channel[], message[])
- {
- printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)!", botid, channel, message);
- IRC_JoinChannel(botid, channel);
- return 1;
- }
- public
- IRC_OnUserDisconnect(botid, user[], host[], message[])
- {
- printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected! (%s)", botid, user, host, message);
- return 1;
- }
- public
- IRC_OnUserJoinChannel(botid, channel[], user[], host[])
- {
- printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s!", botid, user, host, channel);
- return 1;
- }
- public
- IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
- {
- printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)!", botid, user, host, channel, message);
- return 1;
- }
- public
- IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
- {
- printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his nick to %s!", botid, oldnick, host, newnick);
- return 1;
- }
- public
- IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
- {
- printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s!", botid, user, host, channel, mode);
- return 1;
- }
- public
- IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
- {
- printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s!", botid, user, host, channel, topic);
- return 1;
- }
- public
- IRC_OnUserSay(botid, recipient[], user[], host[], message[])
- {
- printf("*** IRC_OnUserSay (Bot ID %d): User %s (%s) sent message to %s: %s", botid, user, host, recipient, message);
- // Someone sent the first bot a private message
- if (!strcmp(recipient, BOT_1_NICKNAME))
- {
- IRC_Say(botid, user, "You sent me a PM!");
- }
- return 1;
- }
- public
- IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
- {
- printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
- // Someone sent the second bot a notice (probably a network service)
- if (!strcmp(recipient, BOT_2_NICKNAME))
- {
- IRC_Notice(botid, user, "You sent me a notice!");
- }
- return 1;
- }
- /*
- This callback is useful for logging, debugging, or catching error messages
- sent by the IRC server.
- */
- public
- IRC_OnReceiveRaw(botid, message[])
- {
- new
- File:file;
- if (!fexist("irc_log.txt"))
- {
- file = fopen("irc_log.txt", io_write);
- }
- else
- {
- file = fopen("irc_log.txt", io_append);
- }
- if (file)
- {
- fwrite(file, message);
- fwrite(file, "\r\n");
- fclose(file);
- }
- return 1;
- }
- /*
- Some examples of channel commands are here. You can add more very easily;
- their implementation is identical to that of ZeeX's zcmd.
- */
- IRCCMD:say(botid, channel[], user[], host[], params[])
- {
- // Check if the user has at least voice in the channel
- if (IRC_IsVoice(botid, channel, user))
- {
- // Check if the user entered any text
- if (!isnull(params))
- {
- new
- msg[128];
- // Echo the formatted message
- format(msg, sizeof(msg), "02*** %s on IRC: %s", user, params);
- IRC_GroupSay(gGroupID, channel, msg);
- format(msg, sizeof(msg), "*** %s on IRC: %s", user, params);
- SendClientMessageToAll(0x0000FFFF, msg);
- }
- }
- return 1;
- }
- IRCCMD:kick(botid, channel[], user[], host[], params[])
- {
- // Check if the user is at least a halfop in the channel
- if (IRC_IsHalfop(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- // If the user did not enter a player ID, then the command will not be processed
- if (sscanf(params, "dz", playerid, reason))
- {
- return 1;
- }
- // If the player is not connected, then nothing will be done
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- // If no reason is given, then "No reason" will be stated
- if (isnull(reason))
- {
- format(reason, sizeof(reason), "No reason");
- }
- // Echo the formatted message and kick the user
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
- IRC_GroupSay(gGroupID, channel, msg);
- format(msg, sizeof(msg), "*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
- SendClientMessageToAll(0x0000FFFF, msg);
- Kick(playerid);
- }
- }
- return 1;
- }
- IRCCMD:ban(botid, channel[], user[], host[], params[])
- {
- // Check if the user is at least an op in the channel
- if (IRC_IsOp(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- // If the user did not enter a player ID, then the command will not be processed
- if (sscanf(params, "dz", playerid, reason))
- {
- return 1;
- }
- // If the player is not connected, then nothing will be done
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- // If no reason is given, then "No reason" will be stated
- if (isnull(reason))
- {
- format(reason, sizeof(reason), "No reason");
- }
- // Echo the formatted message and ban the user
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "02*** %s has been banned by %s on IRC. (%s)", name, user, reason);
- IRC_GroupSay(gGroupID, channel, msg);
- format(msg, sizeof(msg), "*** %s has been banned by %s on IRC. (%s)", name, user, reason);
- SendClientMessageToAll(0x0000FFFF, msg);
- BanEx(playerid, reason);
- }
- }
- return 1;
- }
- IRCCMD:rcon(botid, channel[], user[], host[], params[])
- {
- // Check if the user is at least an op in the channel
- if (IRC_IsOp(botid, channel, user))
- {
- // Check if the user entered any text
- if (!isnull(params))
- {
- // Check if the user did not enter any bad commands
- if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
- {
- // Echo the formatted message and send the command
- new
- msg[128];
- format(msg, sizeof(msg), "RCON command %s has been executed.", params);
- IRC_GroupSay(gGroupID, channel, msg);
- SendRconCommand(params);
- }
- }
- }
- return 1;
- }
- IRCCMD:text(botid, channel[], user[], host[], params[])
- {
- // Check if the user has at least operator in the channel
- if (IRC_IsOp(botid, IRC_CHANNEL, user))
- {
- // Check if the user entered any text
- if (!isnull(params))
- {
- new
- msg[128];
- // Echo the formatted message
- format(msg, sizeof(msg), " %s You have succesfully Send This Text: %s", user, params);
- IRC_GroupSay(gGroupID, IRC_CHANNEL, msg);
- format(msg, sizeof(msg), "%s", params);
- SendClientMessageToAll(0xFFFF00AA, msg);
- }
- }
- return 1;
- }
- IRCCMD:admin(botid, channel[], user[], host[], params[])
- {
- // Check if the user has at least operator in the channel
- if (IRC_IsOp(botid, IRC_CHANNEL, user))
- {
- // Check if the user entered any text
- if (!isnull(params))
- {
- new
- msg[128];
- // Echo the formatted message
- format(msg, sizeof(msg), " %s You Send This Admin Text Message: %s", user, params);
- IRC_GroupSay(botid, IRC_CHANNEL, msg);
- format(msg, sizeof(msg), "Admin: %s", params);
- SendClientMessageToAll(0xFFFF00AA, msg);
- }
- }
- return 1;
- }
- IRCCMD:crash(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsAdmin(botid, channel, user))
- {
- new
- playerid;
- if (sscanf(params, "d", playerid))
- {
- return 1;
- }
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "*** %s Has Crashed %s.", user, name);
- IRC_GroupSay(gGroupID, channel, msg);
- Crash(playerid);
- }
- }
- return 1;
- }
- IRCCMD:quarantine(botid, channel[], user[], host[], params[])
- {
- // Check if the user is at least an op in the channel
- if (IRC_IsOwner(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- // If the user did not enter a player ID, then the command will not be processed
- if (sscanf(params, "ds", playerid, reason))
- {
- return 1;
- }
- // If the player is not connected, then nothing will be done
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- // Echo the formatted message and ban the user
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "02*** %s has put %s in quarantine from IRC.", user, name);
- IRC_GroupSay(gGroupID, channel, msg);
- format(msg, sizeof(msg), "* Admin %s on IRC has put %s in quarantine.", user, name);
- SendClientMessage(playerid, 0x9D000096, msg);
- SetPlayerPos(playerid,-221.059051,1408.984008,27.773437);
- SetPlayerInterior(playerid,18);
- SetPlayerVirtualWorld(playerid,0);
- TogglePlayerControllable(playerid,0);
- }
- }
- return 1;
- }
- IRCCMD:sethp(botid, channel[], user[], host[], params[])
- {
- new string[128], ID, health;
- if(sscanf(params, "is", ID, health))
- return IRC_Say(gGroupID, channel, "Use: !sethealth [ID] [HEALTH]");
- if(IRC_IsOp(botid, channel, user))
- if(!IsPlayerConnected(ID))
- return IRC_Say(gGroupID,channel,"4*** Error: Invalid player ID.");
- SetPlayerHealth(ID, health);
- new oname[MAX_PLAYER_NAME];
- GetPlayerName(ID, oname, sizeof(oname));
- format(string, sizeof(string), "%s has had thier health set to %.0f by IRC admin %s", oname, health, user);
- IRC_Say(gGroupID,channel,string);
- return 1;
- }
- IRCCMD:giveweapon(botid, channel[], user[], host, params[])
- {
- new string[128],
- ID,
- weapid,
- ammo;
- if(sscanf(params, "iii", ID, weapid, ammo))
- return IRC_Say(gGroupID, channel, "Use: !giveweapon [ID] [WEPID] [AMMO]");
- if(IRC_IsAdmin(botid, channel, user))
- if(!IsPlayerConnected(ID))
- return IRC_Say(gGroupID, channel,"4*** Error: Invalid player ID.");
- GivePlayerWeapon(ID, weapid, ammo);
- new oname[MAX_PLAYER_NAME];
- GetPlayerName(ID, oname, sizeof(oname));
- new weapname[24];
- GetWeaponName(weapid, weapname, 32);
- format(string, sizeof(string), "%s has been given a %d with %d ammo by IRC admin %s", oname, weapname, ammo, user);
- SendClientMessageToAll(red, string);
- IRC_Say(gGroupID,channel,string);
- return 1;
- }
- IRCCMD:score(botid, channel[], user[], host[], params[])
- {
- new giveid,msg1[256];
- if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !score <PlayerName/PlayerID>");
- giveid = ReturnUser(params);
- if(!IsPlayerConnected(giveid))return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- format(msg1,256,"10>> Score from %s (ID:%d): %d",PlayerName(giveid),giveid,GetPlayerScore(giveid));
- IRC_GroupSay(gGroupID,channel,msg1);
- return 1;
- }
- IRCCMD:slap(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsOp(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- new Float:pX,Float:pY,Float:pZ;
- new Float:health;
- if (sscanf(params, "ds[64]", playerid, reason))
- {
- return 1;
- }
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- if (isnull(reason))
- {
- format(reason, sizeof(reason), "<no reason defined>");
- }
- GetPlayerName(playerid, name, sizeof(name));
- GetPlayerPos(playerid,pX,pY,pZ);
- GetPlayerHealth(playerid,health);
- SetPlayerHealth(playerid,health-15);
- SetPlayerPos(playerid,pX,pY,pZ+15);
- GetPlayerHealth(playerid,health);
- format(msg, sizeof(msg), "02 %s has slapped by %s on IRC for %s - %.0f health left!", name, user, reason, health);
- IRC_GroupSay(gGroupID, channel, msg);
- }
- }
- return 1;
- }
- IRCCMD:osay(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsOwner(botid, channel, user))
- {
- if (!isnull(params))
- {
- new
- msg[128];
- format(msg, sizeof(msg), "0*** Owner on IRC: %s",params);
- IRC_GroupSay(gGroupID, channel, msg);
- format(msg, sizeof(msg), "*** Owner on IRC: %s",params);
- SendClientMessageToAll(0xFFFFFFAA, msg);
- }
- }
- return 1;
- }
- IRCCMD:asay(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsOp(botid, channel, user))
- {
- if (!isnull(params))
- {
- new
- msg[128];
- format(msg, sizeof(msg), "0*** Admin on IRC: %s",params);
- IRC_GroupSay(gGroupID, channel, msg);
- format(msg, sizeof(msg), "*** Admin on IRC: %s",params);
- SendClientMessageToAll(0xFFFFFFAA, msg);
- }
- }
- return 1;
- }
- IRCCMD:freeze(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsHalfop(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- if (sscanf(params, "ds[64]", playerid, reason))
- {
- return 1;
- }
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- if (isnull(reason))
- {
- format(reason, sizeof(reason), "no reason (Abuse?)");
- }
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "02*** %s has been frozen by %s on IRC. (%s)", name, user, reason);
- IRC_GroupSay(gGroupID, channel, msg);
- TogglePlayerControllable(playerid,0);
- }
- }
- return 1;
- }
- IRCCMD:unfreeze(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsHalfop(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- if (sscanf(params, "ds[64]", playerid, reason))
- {
- return 1;
- }
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- if (isnull(reason))
- {
- format(reason, sizeof(reason), "No Reason");
- }
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "02*** %s has been unfrozen by %s on IRC.", name, user);
- IRC_GroupSay(gGroupID, channel, msg);
- TogglePlayerControllable(playerid,1);
- }
- }
- return 1;
- }
- IRCCMD:gmx(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsAdmin(botid, channel, user))
- {
- new
- msg[128];
- format(msg, sizeof(msg), "The server was restarted by Admin %s.", user);
- IRC_GroupSay(gGroupID, channel, msg);
- SendRconCommand("gmx");
- SendClientMessageToAll(0xFF0000FF, msg);
- }
- return 1;
- }
- IRCCMD:unbanip(botid, channel[], user[], host[], params[])
- {
- new IP[256],msg1[256],msg2[256],Reason[256],msg[100];
- if(IRC_IsAdmin(botid, channel, user))
- if(sscanf(params, "sz",IP,Reason))
- return IRC_GroupSay(gGroupID,channel,"3Usage: !unbanip <IP> <Reason [Optional]>");
- if(!IsStringIP(IP))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid IP.");
- if(!strlen(Reason)) {
- format(msg1,sizeof(msg1),"4*** %s (IRC) unbanned the ip %s",user,IP);
- format(msg2,sizeof(msg2),"*** %s (IRC) unbanned the ip %s",user,IP);
- }
- else {
- format(msg1,sizeof(msg1),"4*** %s (IRC) unbanned the ip %s, reason: %s.",user,IP,Reason);
- format(msg2,sizeof(msg2),"*** %s (IRC) unbanned the ip %s, reason: %s.",user,IP,Reason);
- }
- IRC_GroupSay(gGroupID,channel,msg1);
- format(msg,256,"unbanip %s",IP);
- SendRconCommand(msg);
- SendRconCommand("reloadbans");
- return 1;
- }
- IRCCMD:banip(botid, channel[], user[], host[], params[])
- {
- new IP[256],msg1[256],msg2[256],Reason[256],msg[100];
- if(IRC_IsOp(botid, channel, user))
- if(sscanf(params, "sz",IP,Reason)) return IRC_GroupSay(gGroupID,channel,"3Usage: !banip <IP> <Reason [Optional]>");
- if(!IsStringIP(IP)) return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid IP.");
- if(!strlen(Reason)) {
- format(msg1,sizeof(msg1),"4*** %s (IRC) banned the ip %s",user,IP);
- format(msg2,sizeof(msg2),"*** %s (IRC) banned the ip %s",user,IP);
- }
- else {
- format(msg1,sizeof(msg1),"4*** %s (IRC) banned the ip %s, reason: %s.",user,IP,Reason);
- format(msg2,sizeof(msg2),"*** %s (IRC) banned the ip %s, reason: %s.",user,IP,Reason);
- }
- IRC_GroupSay(gGroupID,channel,msg1);
- format(msg,256,"banip %s",IP);
- SendRconCommand(msg);
- return 1;
- }
- IRCCMD:explode(botid, channel[], user[], host[], params[])
- {
- new string[128],
- ID;
- if(sscanf(params, "i", ID))
- return IRC_GroupSay(gGroupID, channel, "Use: !explode [ID]");
- if(IRC_IsOp(botid, channel, user))
- if(!IsPlayerConnected(ID))
- return IRC_GroupSay(gGroupID, channel,"4*** Error: Invalid player ID.");
- new Float:x, Float:y, Float:z;
- GetPlayerPos(ID, x, y, z);
- CreateExplosion(x, y, z, 10, 0);
- new oname[MAX_PLAYER_NAME];
- GetPlayerName(ID, oname, sizeof(oname));
- format(string, sizeof(string), "%s has been nuked %s", oname, user);
- IRC_GroupSay(gGroupID,channel,string);
- return 1;
- }
- IRCCMD:givemoney(botid, channel[], user[], host[], params[])
- {
- new string[128],
- ID,
- amount;
- if(sscanf(params, "ii", ID, amount))
- return IRC_GroupSay(gGroupID, channel, "Use: !givemoney [ID] [AMMOUNT]");
- if(IRC_IsOp(botid,channel,user))
- if(!IsPlayerConnected(ID))
- return IRC_GroupSay(gGroupID, channel,"4*** Error: Invalid player ID.");
- GivePlayerMoney(ID, amount);
- new oname[MAX_PLAYER_NAME];
- GetPlayerName(ID, oname, sizeof(oname));
- format(string, sizeof(string), "\"%s\" has been given $%d by IRC admin \"%s\"", oname, amount, user);
- IRC_GroupSay(gGroupID,channel,string);
- return 1;
- }
- IRCCMD:setname(botid, channel[], user[], host[], params[])
- {
- new string[128], ID, newname[32];
- if(sscanf(params, "is", ID, newname))
- return IRC_GroupSay(gGroupID, channel, "Use: !setname [ID] [NAME]");
- if(IRC_IsOwner(botid, channel, user))
- if(!IsPlayerConnected(ID))
- return IRC_GroupSay(gGroupID, channel,"4*** Error: Invalid player ID.");
- new oname[MAX_PLAYER_NAME];
- GetPlayerName(ID, oname, sizeof(oname));
- format(string, sizeof(string), "%s has had his name set to %s by IRC admin %s", oname, newname, user);
- SetPlayerName(ID, newname);
- IRC_GroupSay(gGroupID,channel,string);
- return 1;
- }
- IRCCMD:ip(botid, channel[], user[], host[], params[])
- {
- new giveid, msg[256], Ip[256];
- if(IRC_IsHalfop(botid, channel, user))
- if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !ip <PlayerName/PlayerID>");
- giveid = ReturnUser(params);
- if(!IsPlayerConnected(giveid)) return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- GetPlayerIp(giveid,Ip,256);
- format(msg,256,"3>> IP from %s (ID:%d):1 %s",PlayerName(giveid),giveid,Ip);
- IRC_GroupSay(gGroupID,channel,msg);
- return 1;
- }
- IRCCMD:pm(botid, channel[], user[], host[], params[])
- {
- new giveid, msg[256],lolz1[256], lolz2[256], pon[256];
- if(sscanf(params,"ss[256]",pon,msg)) return IRC_GroupSay(gGroupID,channel,"3Usage: !pm <PlayerName/PlayerID> <Message>");
- giveid = ReturnUser(pon);
- if(!IsPlayerConnected(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- format(lolz1,256, "*** PM from %s (IRC): %s",user, msg);
- format(lolz2,256, "5*** PM to %s (ID:%d):1 %s",PlayerName(giveid),giveid,msg);
- SendClientMessage(giveid,green,lolz1);
- IRC_GroupSay(gGroupID, channel, lolz2);
- return 1;
- }
- IRCCMD:hp(botid, channel[], user[], host[], params[])
- {
- new pon[30], giveid, msg[256], Float: Health, Float: Armour;
- if(sscanf(params,"s",pon)) return
- IRC_GroupSay(gGroupID,channel,"3Usage: !hp <PlayerName/PlayerID>");
- giveid = ReturnUser(pon);
- if(!IsPlayerConnected(giveid)) return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- GetPlayerHealth(giveid,Health);
- GetPlayerArmour(giveid,Armour);
- format(msg,256,"10>> (%s) Health: %s %.0f - Armour: %s %.0f",PlayerName(giveid),PercentBar(Health),Health,PercentBar(Armour),Armour);
- IRC_GroupSay(gGroupID,channel,msg);
- return 1;
- }
- IRCCMD:eject(botid, channel[], user[], host[], params[])
- {
- new giveid,msg1[256],msg2[256],msg[256],pon[100];
- if(IRC_IsOp(botid, channel, user))
- if(sscanf(params,"sz",pon,msg)) return IRC_GroupSay(gGroupID,channel,"3Usage: !eject <PlayerName/PlayerID> <Reason [Optional]>");
- giveid = ReturnUser(pon);
- if(!IsPlayerConnected(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- if(!IsPlayerInAnyVehicle(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: The selected id is not in a vehicle.");
- if(!strlen(msg)) {
- format(msg1,sizeof(msg1),"4*** %s (IRC) eject of the vehicle to %s (ID:%d).",user,PlayerName(giveid),giveid);
- format(msg2,sizeof(msg2),"*** %s (IRC) eject of the vehicle to %s (ID:%d).",user,PlayerName(giveid),giveid);
- }
- else {
- format(msg1,sizeof(msg1),"4*** %s (IRC) eject of the vehicle to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
- format(msg2,sizeof(msg2),"*** %s (IRC) eject of the vehicle to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
- }
- IRC_GroupSay(gGroupID,channel,msg1);
- SendClientMessageToAll(red,msg2);
- RemovePlayerFromVehicle(giveid);
- return 1;
- }
- IRCCMD:getid(botid, channel[], user[], host[], params[])
- {
- new GetPlayer[256],giveid,lolz1[256],lolz2[256];
- if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !getid <PartOfName>");
- for (giveid=0; giveid<=MAX_PLAYERS; giveid++){
- if (IsPlayerConnected(giveid)){
- GetPlayerName(giveid,GetPlayer,16);
- new space = (strfind(GetPlayer, params, true));
- if (space != -1){
- format(lolz1, sizeof(lolz1), "10>> Player whose name is %s 10has the ID: %d", GetPlayer, giveid);
- IRC_GroupSay(gGroupID,channel,lolz1);
- return 1;
- }
- }
- }
- format(lolz2, sizeof(lolz2),"4*** Error: Invalid Name", params[0]);
- IRC_GroupSay(gGroupID,channel,lolz2);
- return 1;
- }
- IRCCMD:players(botid, channel[], user[], host[], params[])
- {
- new count, PlayerNames[512];
- for(new i=0; i<=MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(count == 0)
- {
- new PlayerName1[MAX_PLAYER_NAME];
- GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
- format(PlayerNames, sizeof(PlayerNames),"[%d] %s",i,PlayerName1);
- count++;
- }
- else
- {
- new PlayerName1[MAX_PLAYER_NAME];
- GetPlayerName(i, PlayerName1, sizeof(PlayerName1));
- format(PlayerNames, sizeof(PlayerNames),"%s, [%d] %s",PlayerNames,i,PlayerName1);
- count++;
- }
- }
- else { if(count == 0) format(PlayerNames, sizeof(PlayerNames),"No Players Online"); }
- }
- new counter = 0, msg[256], players = GetMaxPlayers();
- for(new i=0; i<=MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i)) counter++;
- }
- format(msg,256,"10>> Players Online [%d/%d]: %s",counter,players,PlayerNames);
- IRC_GroupSay(gGroupID, channel, msg);
- return 1;
- }
- IRCCMD:kill(botid, channel[], user[], host[], params[])
- {
- new giveid,msg1[255],msg2[255],Reason[256],pon[100];
- if(IRC_IsOp(botid, channel, user))
- if(sscanf(params,"sz[255]",pon,Reason))
- return IRC_GroupSay(gGroupID,channel,"3Usage: !kill <PlayerName/PlayerID> <Reason [Optional]>");
- giveid = ReturnUser(pon);
- if(!IsPlayerConnected(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Player ID");
- if(!strlen(Reason)) {
- format(msg1,sizeof(msg1),"4*** %s (IRC) killed player %s (ID:%d).",user,PlayerName(giveid),giveid);
- format(msg2,sizeof(msg2),"*** %s (IRC) killed player %s (ID:%d).",user,PlayerName(giveid),giveid);
- }
- else {
- format(msg1,sizeof(msg1),"4*** %s (IRC) killed player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
- format(msg2,sizeof(msg2),"*** %s (IRC) killed player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
- }
- IRC_GroupSay(gGroupID,channel,msg1);
- SendClientMessageToAll(red,msg2);
- SetPlayerHealth(giveid,0);
- SetPlayerArmour(giveid,0);
- return 1;
- }
- IRCCMD:name(botid, channel[], user[], host[], params[])
- {
- new msg1[256];
- if(isnull(params))
- return IRC_GroupSay(gGroupID,channel,"3Usage: !name <PlayerID>");
- if(!IsPlayerConnected(strval(params)))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Player ID");
- format(msg1,256,"10>> ID: %d 10is %s",strval(params),PlayerName(strval(params)));
- IRC_GroupSay(gGroupID,channel,msg1);
- return 1;
- }
- IRCCMD:disarm(botid, channel[], user[], host[], params[])
- {
- new giveid,msg[256],msg1[256],msg2[256],pon[100];
- if(IRC_IsOp(botid, channel, user))
- if(sscanf(params,"sz",pon,msg))
- return IRC_GroupSay(gGroupID,channel,"3Usage: !disarm <PlayerName/PlayerID> <Reason [Optional]>");
- giveid = ReturnUser(pon);
- if(!IsPlayerConnected(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- if(GetPlayerTotalWeapons(giveid) == 0)
- return IRC_GroupSay(gGroupID,channel,"4*** Error: The player has no weapon.");
- if(!strlen(msg)) {
- format(msg1,sizeof(msg1),"4*** %s (IRC) removed the weapons to %s (ID:%d).",user,PlayerName(giveid),giveid);
- format(msg2,sizeof(msg2),"*** %s (IRC) removed the weapons to %s (ID:%d).",user,PlayerName(giveid),giveid);
- }
- else {
- format(msg1,sizeof(msg1),"4*** %s (IRC) removed the weapons to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
- format(msg2,sizeof(msg2),"*** %s (IRC) removed the weapons to %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,msg);
- }
- SendClientMessageToAll(red,msg2);
- IRC_GroupSay(gGroupID,channel,msg1);
- ResetPlayerWeapons(giveid);
- return 1;
- }
- IRCCMD:time(botid, channel[], user[], host[], params[])
- {
- new msg1[256],hour,minute,second,year,month,day;
- gettime(hour,minute,second);
- getdate(year,month,day);
- format(msg1,256,"10>> Day: %02d/%02d/%02d 10Hour: %02d:%02d:%02d",day,month,year,hour,minute,second);
- IRC_GroupSay(gGroupID,channel,msg1);
- return 1;
- }
- IRCCMD:money(botid, channel[], user[], host[], params[])
- {
- new giveid,msg1[256];
- if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !money <PlayerName/PlayerID>");
- giveid = ReturnUser(params);
- if(!IsPlayerConnected(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- format(msg1,256,"10>> Money from %s (ID:%d): $%d",PlayerName(giveid),giveid,GetPlayerMoney(giveid));
- IRC_GroupSay(gGroupID,channel,msg1);
- return 1;
- }
- IRCCMD:fakemsg(botid, channel[], user[], host[], params[])
- {
- new giveid,msg[256],lolz1[256],pon[100];
- if(IRC_IsAdmin(botid, channel, user))
- if(sscanf(params,"ss",pon,msg))
- return IRC_GroupSay(gGroupID,channel,"3Usage: !fakemsg <PlayerName/PlayerID> <Message>");
- giveid = ReturnUser(pon);
- if(!IsPlayerConnected(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid player ID.");
- format(lolz1,256,"2[%i]7 %s: %s",giveid,PlayerName(giveid),msg);
- SendPlayerMessageToAll(giveid,msg);
- IRC_GroupSay(gGroupID,channel,lolz1);
- return 1;
- }
- IRCCMD:ann(botid, channel[], user[], host[], params[])
- {
- new lolz[256];
- if(IRC_IsOp(botid, channel, user))
- if(!strlen(params))
- return IRC_GroupSay(gGroupID, channel,"5Correct Usage: !ann <message>");
- format(lolz, 256, "2Announcement from %s: %s", user, params);
- IRC_GroupSay(gGroupID, channel, lolz);
- SendClientMessageToAll(blue,"-------------------------------------------");
- SendClientMessageToAll(red,params);
- SendClientMessageToAll(blue,"-------------------------------------------");
- return true;
- }
- IRCCMD:hostname(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsOwner(botid,channel,user))
- {
- new cmd[45];
- format(cmd,sizeof cmd,"hostname %s",params);
- SendRconCommand(cmd);
- IRC_GroupSay(gGroupID, channel,"2Server Hostname Set.");
- }
- else IRC_GroupSay(gGroupID, channel,"4Error: You must be owner to use this command.");
- return 1;
- }
- IRCCMD:mapname(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsOwner(botid,channel,user))
- {
- new cmd[45];
- format(cmd,sizeof cmd,"mapname %s",params);
- SendRconCommand(cmd);
- IRC_GroupSay(gGroupID, channel,"2Server Mapname Set.");
- }
- else IRC_GroupSay(gGroupID, channel,"4Error: You must be owner to use this command.");
- return 1;
- }
- IRCCMD:part(botid, channel[], user[], host[], params[])
- {
- new id,msg[100],chan[100],msg1[100];
- if(IRC_IsOwner(botid,channel,user))
- if(sscanf(params,"ds",id,chan)) return IRC_GroupSay(gGroupID,channel,"3Usage: !part <channel>");
- if(id == 1) {
- if(strfind(chan,"#",true,0)!= -1)
- {
- format(msg,256,"3>> %s has left of the channel %s",BOT_1_NICKNAME, chan);
- IRC_GroupSay(gGroupID, channel, msg);
- IRC_PartChannel(botid,chan);
- }
- else
- {
- format(msg1,256,"#%s",chan);
- format(msg,256,"3>> %s has left of the channel %s",BOT_1_NICKNAME, msg1);
- IRC_GroupSay(gGroupID, channel, msg);
- IRC_PartChannel(botid,msg1);
- }
- }
- else return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Bot ID. (1/2)");
- return 1;
- }
- IRCCMD:cmds(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsVoice(botid, channel, user))
- IRC_GroupSay(gGroupID, channel,"Voice Cmds: !name, !getid, !players, !pm, !say, !admins, !score, !credits");
- if(IRC_IsHalfop(botid, channel, user))
- IRC_GroupSay(gGroupID, channel, "Halfop Cmds: !Hp, !Ip, !Money, !Freeze, !UnFreeze, !kick, !Jail, !unjail, !warn, !admin.");
- if(IRC_IsOp(botid, channel, user))
- IRC_GroupSay(gGroupID, channel, "Op Cmds: !ban, !explode, !banip, !eject, !asay, !Kill, !disarm, !ann, !slap, !force, !xyz, !sethp, !text.");
- if(IRC_IsAdmin(botid, channel, user))
- IRC_GroupSay(gGroupID, channel, "Admin Cmds: !givemoney, !gmx, !fakemsg, !giveweapon,");
- if(IRC_IsOwner(botid, channel, user))
- IRC_GroupSay(gGroupID, channel, "Owner Cmds: !rcon, !setname, !osay, !hostname, !mapname, !raw, !part, !join, !quarantine.");
- return true;
- }
- IRCCMD:join(botid, channel[], user[], host[], params[])
- {
- new id,msg[100],chan[100],pass[20],msg1[100];
- if(IRC_IsAdmin(botid, channel, user))
- if(sscanf(params,"dsz",id,chan,pass)) return IRC_GroupSay(gGroupID,channel,"3Usage: !join <channel>");
- if(id == 1)
- {
- if(strfind(chan,"#",true,0)!= -1)
- {
- if(IRC_IsUserOnChannel(botid,chan,BOT_1_NICKNAME) == 1)
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Bot already in the channel.");
- format(msg,256,"3>> %s has joined to %s",BOT_1_NICKNAME, chan);
- IRC_GroupSay(gGroupID, channel, msg);
- if(!strlen(pass)) IRC_JoinChannel(botid,chan,"");
- else IRC_JoinChannel(botid,chan,pass);
- }
- else
- {
- format(msg1,256,"#%s",chan);
- if(IRC_IsUserOnChannel(botid,msg1,BOT_1_NICKNAME) == 1) return IRC_GroupSay(gGroupID,channel,"4*** Error: Bot already in the channel.");
- format(msg,256,"3>> %s has joined to %s",botid, msg1);
- IRC_GroupSay(gGroupID,channel, msg);
- if(!strlen(pass)) IRC_JoinChannel(botid,msg1,"");
- else IRC_JoinChannel(botid,msg1,pass);
- }
- }
- else return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Bot ID.");
- return 1;
- }
- IRCCMD:xyz(botid, channel[], user[], host[], params[])
- {
- new giveid, msg1[256];
- if(IRC_IsAdmin(botid, channel, user))
- if(isnull(params)) return IRC_GroupSay(gGroupID,channel,"3Usage: !xyz <PlayerName/PlayerID>");
- giveid = ReturnUser(params);
- new Float:X,Float:Y,Float:Z,Float:A;
- GetPlayerPos(giveid,X,Y,Z);
- GetPlayerFacingAngle(giveid,A);
- format(msg1,256,"10>> Position from %s (ID:%d): X: %f10, Y: %f10, Z: %f10, A: %f",PlayerName(giveid),giveid,X,Y,Z,A);
- IRC_GroupSay(gGroupID,channel,msg1);
- return 1;
- }
- // EDIT THESE 3 Commands YOURSELF!
- /*IRCCMD:admins(botid, channel[], user[], host[], params[])
- {
- new count,lolz1[200];
- for (new giveid; giveid != GetMaxPlayers(); giveid ++)
- {
- if (!IsPlayerConnected(giveid)) continue;
- if (PlayerInfo[giveid][AdminLevel] < 1)
- {
- if(count == 0) IRC_GroupSay(gGroupID,channel,"3*** Admin's Online:1");
- GetPlayerName(giveid,lolz1,32);
- format(lolz1,200,"[%d] %s",giveid,lolz1);
- IRC_GroupSay(gGroupID,channel,lolz1);
- count++;
- }
- }
- if (count == 0) return IRC_GroupSay(gGroupID,channel,"4*** Unfortiantly there are no admins's online");
- return true;
- }*/
- /*
- IRCCMD:jail(botid, channel[], user[], host[], params[])
- {
- if(IRC_IsHalfop(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- if (sscanf(params, "ds", playerid, reason))
- {
- return 1;
- }
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- if (isnull(reason))
- {
- format(reason, sizeof(reason), "no reason defined");
- }
- if(PlayerInfo[playerid][Jailed] == 1)
- {
- IRC_GroupSay(gGroupID, channel, "ERROR: This Player is already Jailed");
- }
- else
- {
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "02*** %s has been Jailed by %s on IRC. (%s)", name, user, reason);
- SendClientMessageToAll(COLOR_WHITE, msg);
- IRC_GroupSay(gGroupID, channel, msg);
- PlayerInfo[playerid][Jailed] = 1;
- SendClientMessage(playerid,red,"Next, Learn The rules, Follow what the admins tell you");
- SetPlayerPos(playerid,3619.159,-716.425,1.069);
- }
- }
- }
- return 1;
- }
- IRCCMD:unjail(botid, channel[], user[], host[], params[])
- {
- if (IRC_IsHalfop(botid, channel, user))
- {
- new
- playerid,
- reason[64];
- if (sscanf(params, "ds", playerid, reason))
- {
- return 1;
- }
- if (IsPlayerConnected(playerid))
- {
- new
- msg[128],
- name[MAX_PLAYER_NAME];
- if (isnull(reason))
- {
- format(reason, sizeof(reason), "<no reason defined>");
- }
- if(PlayerInfo[playerid][Jailed] == 0) {
- IRC_Say(gGroupID, channel, "ERROR: Player isn't Jailed!"); }
- else {
- GetPlayerName(playerid, name, sizeof(name));
- format(msg, sizeof(msg), "02*** %s Has been unjaild by %s on The IRC. (%s)", name, user, reason);
- SendClientMessageToAll(COLOR_WHITE,msg);
- IRC_Say(gGroupID, channel, msg);
- PlayerInfo[playerid][Jailed] = 0;
- SetPlayerHealth(playerid,0);
- }
- }
- }
- return 1;
- }*/
- IRCCMD:force(botid, channel[], user[], host[], params[])
- {
- new giveid,msg1[255],msg2[255],Reason[256],pon[100];
- if(IRC_IsOp(botid, channel, user))
- if(sscanf(params,"sz",pon,Reason))
- return IRC_GroupSay(gGroupID,channel,"3Usage: !force <PlayerName/PlayerID> <Reason [Optional]>");
- giveid = ReturnUser(pon);
- if(!IsPlayerConnected(giveid))
- return IRC_GroupSay(gGroupID,channel,"4*** Error: Invalid Player ID");
- if(!strlen(Reason)) {
- format(msg1,sizeof(msg1),"4*** %s (IRC) Forced player %s (ID:%d).",user,PlayerName(giveid),giveid);
- format(msg2,sizeof(msg2),"*** %s (IRC) Forced player %s (ID:%d).",user,PlayerName(giveid),giveid);
- }
- else {
- format(msg1,sizeof(msg1),"4*** %s (IRC) Forced player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
- format(msg2,sizeof(msg2),"*** %s (IRC) Forced player %s (ID:%d), reason: %s.",user,PlayerName(giveid),giveid,Reason);
- }
- IRC_GroupSay(gGroupID,channel,msg1);
- SendClientMessageToAll(red,msg2);
- SetPlayerHealth(giveid,0);
- SetPlayerArmour(giveid,0);
- ForceClassSelection(giveid);
- return 1;
- }
- IRCCMD:raw(botid, channel[], user[], host[], params[])
- {
- new id,msg[256],iparams[256];
- if(IRC_IsOwner(botid, channel, user))
- if(sscanf(params,"ds",id,iparams)) return IRC_GroupSay(gGroupID, channel, "3Usage: !ircraw <BotID [1/2]> <Params>");
- if(id == 1)
- {
- format(msg,256,"3** RAW command for IRC:1 %s", iparams);
- IRC_Say(gGroupID, channel, msg);
- IRC_SendRaw(botid,iparams);
- }
- return 1;
- }
- IRCCMD:Credits(botid, channel[], user[], host[], params[])
- {
- IRC_GroupSay(gGroupID, channel, " This IRC Script Has Been made by Porsche911!");
- return 1;
- }
- stock IsStringIP(string[])
- {
- new icnt;
- new port;
- for(new i=0,j=strlen(string);i<j;i++){
- if(string[i] == '.') icnt++;
- else if(string[i] ==':') port++;
- }
- if(icnt == 3){
- if(port == 1) return 2;
- else if(port == 0) return 1;
- }
- return 0;
- }
- ReturnUser(text[])
- {
- new pos = 0;
- while (text[pos] < 0x21)
- {
- if (text[pos] == 0) return INVALID_PLAYER_ID;
- pos++;
- }
- new userid = INVALID_PLAYER_ID;
- if (IsNumeric(text[pos]))
- {
- userid = strval(text[pos]);
- if (userid >=0 && userid < MAX_PLAYERS)
- {
- if(!IsPlayerConnected(userid))
- {
- userid = INVALID_PLAYER_ID;
- }
- else
- {
- return userid;
- }
- }
- }
- new giveid;
- new GetPlayer[256];
- for (giveid=0; giveid<=MAX_PLAYERS; giveid++)
- {
- if (IsPlayerConnected(giveid))
- {
- GetPlayerName(giveid,GetPlayer,16);
- new space = (strfind(GetPlayer, text,true));
- if (space != -1)
- {
- return giveid;
- }
- }
- }
- return userid;
- }
- stock PercentBar(Float:data)
- {
- new x[256];
- if (data >= 100)x = "[IIIIIIIIII]";
- else if (data >= 110)x = "HACKER, BAN!";
- else if (data >= 90) x = "[IIIIIIIII-]";
- else if (data >= 80) x = "[IIIIIIII--]";
- else if (data >= 70) x = "[IIIIIII---]";
- else if (data >= 60) x = "[IIIIII----]";
- else if (data >= 50) x = "[IIIII-----]";
- else if (data >= 40) x = "[IIII------]";
- else if (data >= 30) x = "[III-------]";
- else if (data >= 20) x = "[II--------]";
- else if (data >= 10) x = "[I---------]";
- else x = "[No HP FOUND!]";
- return x;
- }
- stock GetPlayerTotalWeapons(playerid)
- {
- new TW = 0;
- for(new a=0; a <= 9; a++){
- new weapon, ammo;
- GetPlayerWeaponData(playerid,a,weapon,ammo);
- if(ammo != 0 && weapon != 0){
- TW++;
- }
- }
- return TW;
- }
- /*
- Here is a very useful function by Y_Less for obtaining tokens from strings:
- sscanf. It is used in the channel commands above. I recommend using the
- plugin version (sscanf 2.0), however.
- */
- stock
- sscanf(string[], format[], {Float,_}:...)
- {
- #if defined isnull
- if (isnull(string))
- #else
- if (string[0] == 0 || (string[0] == 1 && string[1] == 0))
- #endif
- {
- return format[0];
- }
- #pragma tabsize 4
- new
- formatPos = 0,
- stringPos = 0,
- paramPos = 2,
- paramCount = numargs(),
- delim = ' ';
- while (string[stringPos] && string[stringPos] <= ' ')
- {
- stringPos++;
- }
- while (paramPos < paramCount && string[stringPos])
- {
- switch (format[formatPos++])
- {
- case '\0':
- {
- return 0;
- }
- case 'i', 'd':
- {
- new
- neg = 1,
- num = 0,
- ch = string[stringPos];
- if (ch == '-')
- {
- neg = -1;
- ch = string[++stringPos];
- }
- do
- {
- stringPos++;
- if ('0' <= ch <= '9')
- {
- num = (num * 10) + (ch - '0');
- }
- else
- {
- return -1;
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num * neg);
- }
- case 'h', 'x':
- {
- new
- num = 0,
- ch = string[stringPos];
- do
- {
- stringPos++;
- switch (ch)
- {
- case 'x', 'X':
- {
- num = 0;
- continue;
- }
- case '0' .. '9':
- {
- num = (num << 4) | (ch - '0');
- }
- case 'a' .. 'f':
- {
- num = (num << 4) | (ch - ('a' - 10));
- }
- case 'A' .. 'F':
- {
- num = (num << 4) | (ch - ('A' - 10));
- }
- default:
- {
- return -1;
- }
- }
- }
- while ((ch = string[stringPos]) > ' ' && ch != delim);
- setarg(paramPos, 0, num);
- }
- case 'c':
- {
- setarg(paramPos, 0, string[stringPos++]);
- }
- case 'f':
- {
- setarg(paramPos, 0, _:floatstr(string[stringPos]));
- }
- case 'p':
- {
- delim = format[formatPos++];
- continue;
- }
- case '\'':
- {
- new
- end = formatPos - 1,
- ch;
- while ((ch = format[++end]) && ch != '\'') {}
- if (!ch)
- {
- return -1;
- }
- format[end] = '\0';
- if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1)
- {
- if (format[end + 1])
- {
- return -1;
- }
- return 0;
- }
- format[end] = '\'';
- stringPos = ch + (end - formatPos);
- formatPos = end + 1;
- }
- case 'u':
- {
- new
- end = stringPos - 1,
- id = 0,
- bool:num = true,
- ch;
- while ((ch = string[++end]) && ch != delim)
- {
- if (num)
- {
- if ('0' <= ch <= '9')
- {
- id = (id * 10) + (ch - '0');
- }
- else
- {
- num = false;
- }
- }
- }
- if (num && IsPlayerConnected(id))
- {
- setarg(paramPos, 0, id);
- }
- else
- {
- #if !defined foreach
- #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2))
- #define __SSCANF_FOREACH__
- #endif
- string[end] = '\0';
- num = false;
- new
- name[MAX_PLAYER_NAME];
- id = end - stringPos;
- foreach (Player, playerid)
- {
- GetPlayerName(playerid, name, sizeof (name));
- if (!strcmp(name, string[stringPos], true, id))
- {
- setarg(paramPos, 0, playerid);
- num = true;
- break;
- }
- }
- if (!num)
- {
- setarg(paramPos, 0, INVALID_PLAYER_ID);
- }
- string[end] = ch;
- #if defined __SSCANF_FOREACH__
- #undef foreach
- #undef __SSCANF_FOREACH__
- #endif
- }
- stringPos = end;
- }
- case 's', 'z':
- {
- new
- i = 0,
- ch;
- if (format[formatPos])
- {
- while ((ch = string[stringPos++]) && ch != delim)
- {
- setarg(paramPos, i++, ch);
- }
- if (!i)
- {
- return -1;
- }
- }
- else
- {
- while ((ch = string[stringPos++]))
- {
- setarg(paramPos, i++, ch);
- }
- }
- stringPos--;
- setarg(paramPos, i, '\0');
- }
- default:
- {
- continue;
- }
- }
- while (string[stringPos] && string[stringPos] != delim && string[stringPos] > ' ')
- {
- stringPos++;
- }
- while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= ' '))
- {
- stringPos++;
- }
- paramPos++;
- }
- do
- {
- if ((delim = format[formatPos++]) > ' ')
- {
- if (delim == '\'')
- {
- while ((delim = format[formatPos++]) && delim != '\'') {}
- }
- else if (delim != 'z')
- {
- return delim;
- }
- }
- }
- while (delim > ' ');
- return 0;
- }
- stock Crash(playerid)
- {
- return ApplyAnimation(playerid, "GANG", "DRUGS_BUY", 10, 0, 0, 0, 0, 5*1000);
- }
- stock PlayerName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,MAX_PLAYER_NAME);
- return name;
- }
- IsNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement