Need a little help.
#1

Hey there,

I've been trying to script an /irc CMD .. this is what I got so far, not getting any errors however when I use for an example /irc join it sends me a message saying it's an unknown parameter which it's not.

pawn Код:
CMD:irc(playerid, params[])
{
new        option[ 50 ];
if( sscanf ( params, "s[50]", option ) ) return SendClientMessage( playerid, -1, "USAGE: /irc [join/leave/members/help]" );
//------------------------------------------------------------------------------
if( !strcmp( option,"Join" ) )
{
new ircc = PlayerInfo[playerid][pIRC], pnamee[MAX_PLAYER_NAME], str[80];
if(sscanf(params, "i", ircc)) return SCM(playerid, -1, "USAGE: /irc join [channel number]!");
if(ircc > 3) return SCM(playerid, -1, "Channels available: 1-3!");
if(ircc == 1)
{
GetPlayerName(playerid, pnamee, sizeof(pnamee));
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"IRChannels");
INI_WriteInt(File,"IRC",PlayerInfo[playerid][pIRC]=1);
INI_Close(File);
SCM(playerid, -1,"You have joined IRC channel 1!");
format(str, sizeof(str), "%s has joined IRC channel 1!", pnamee);
SIM(-1,str);
}
if(ircc == 2)
{
GetPlayerName(playerid, pnamee, sizeof(pnamee));
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"IRChannels");
INI_WriteInt(File,"IRC",PlayerInfo[playerid][pIRC]=2);
INI_Close(File);
SCM(playerid, -1,"You have joined IRC channel 2!");
format(str, sizeof(str), "%s has joined IRC channel 2!", pnamee);
SIM2(-1,str);
}
if(ircc == 3)
{
GetPlayerName(playerid, pnamee, sizeof(pnamee));
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"IRChannels");
INI_WriteInt(File,"IRC",PlayerInfo[playerid][pIRC]=3);
INI_Close(File);
SCM(playerid, -1,"You have joined IRC channel 3!");
format(str, sizeof(str), "%s has joined IRC channel 3!", pnamee);
SIM3(-1,str);
}
}
//------------------------------------------------------------------------------
else if( !strcmp(option,"Leave" ) )
{
if(PlayerInfo[playerid][pIRC] == 0) return SCM(playerid, -1, "You are not connected to any IRC channel!");
else
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"IRChannels");
INI_WriteInt(File,"IRC",PlayerInfo[playerid][pIRC]=0);
INI_Close(File);
SCM(playerid, -1,"You have left the IRC channel!");
}
}
//------------------------------------------------------------------------------
else if( !strcmp( option,"Members" ) )
{
if(PlayerInfo[playerid][pIRC] == 0) return SCM(playerid, -1, "You are not connected to an IRC!");
new iname[MAX_PLAYER_NAME], str[30];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pIRC] == PlayerInfo[playerid][pIRC])
{
GetPlayerName(i, iname, sizeof(iname));
format(str, sizeof(str), "%s", iname);
SCM(playerid, -1, "IRC MEMBERS ONLINE:");
SCM(playerid, -1, str);
}
}
}
}
//------------------------------------------------------------------------------
else if( !strcmp( option,"Help" ) )
{
SCM(playerid, -1,"IRC HELP:");
SCM(playerid, -1,"Use (/i [text]) to send a certain message to the players connected to the same IRC as you!");
SCM(playerid, -1,"Use (/irc join [channel number]) to join a specific channel!");
SCM(playerid, -1,"Use (/irc leave) to leave the current channel you're connected to!");
SCM(playerid, -1,"Use (/irc members) to check the players online connected to the IRC channel you're in!");
}
//------------------------------------------------------------------------------
else
{
SendClientMessage( playerid, -1, "Unknown parameter - parameters available:[join/leave/members/help]" );
}
return 1;
}
Thanks in advance.
Reply
#2

Nevermind I figured out the problem.
Reply
#3

Since I posted this already, i'm also having a problem with /irc join ... how can I make it ummm a triple parameter ? the way I've done it up there or I need to use other way?
Reply
#4

You can edit it to write this, in 6 minutes 3 posts..
Reply
#5

Quote:
Originally Posted by moadi
Посмотреть сообщение
Since I posted this already, i'm also having a problem with /irc join ... how can I make it ummm a triple parameter ? the way I've done it up there or I need to use other way?
You would just need to change this line:

pawn Код:
if(sscanf(params, "i", ircc)) return SCM(playerid, -1, "USAGE: /irc join [channel number]!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)