29.03.2011, 00:40
I was wondering how I would go about making a command so it would work In-Game but it would look as if it's an IRC Command. For example, say my code is /cookie. What I want to do is to make it !cookie and if I typed an ID then it would give that player a cookie otherwise it would just give the player who did the command the cookie. Here is the code I have so far...
What I want to do is for one thing to make the IRC Command so it will not only work for player id 1. I also want to make this command and '!' command. I am using Incognito's IRC Plugin v1.4.1
pawn Код:
IRCCMD:cookie(botid, channel[], user[], host[], params[])
{
new playerid;
// Check if the player is connected
if (IsPlayerConnected(playerid))
{
// Echo the formatted message
new cookiemsg[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(cookiemsg, sizeof(cookiemsg), "%s has received a cookie from %s(IRC).", name, user);
IRC_GroupSay(gGroupID, channel, cookiemsg);
format(cookiemsg, sizeof(cookiemsg), "%s has received a cookie from %s(IRC).", name, user);
SendClientMessageToAll(COLOR_ORANGE, cookiemsg);
SetPlayerHealth(playerid,100);
format(cookiemsg, sizeof(cookiemsg), "You have received a cookie from %s(IRC).", name, user);
SendClientMessage(playerid,0x00A765AA,cookiemsg);
}
return 1;
}