PM command
#1

Can someone tell me why this command doesnt work:

pawn Код:
new string[200], iUser[80], iMsg[200];
    if(sscanf(params, "s[80]s[200]", iUser, iMsg)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [user] [message]");
    if(!IRC_IsUserOnChannel(groupID, IRC_CHANNEL, iUser))
    {
    format(string, sizeof(string), "* The name '%s' is not currently connected to the IRC channel.", iUser);
    SendClientMessage(playerid, COLOR_RED, string);
    }
    else
    {
    format(string, sizeof(string), "* Your message has been sent to %s", iUser);
    SendClientMessage(playerid, COLOR_RED, string);
    format(string, sizeof(string), "* PM from %s [%d]: %s", ReturnPlayerName(playerid), playerid, iMsg);
    IRC_Notice(groupID, iUser, string);
    }
I always get
Quote:

USAGE: /ircpm [user] [message]

even if i type all params correctly.
Reply
#2

SA-MP can only accept a certain amount as input... "s[80]s[200]" is seriously WAY too big.

Quote:

Text Input (Chat/Commands) 128 cells (512 bytes)
Text Output (Chat/Commands) 144 cells (576 bytes)

I wouldn't know if this is the issue, but oversized things are simply bad.
Reply
#3

Quote:
Originally Posted by Despacito
Посмотреть сообщение
Can someone tell me why this command doesnt work:

pawn Код:
new string[200], iUser[80], iMsg[200];
    if(sscanf(params, "s[80]s[200]", iUser, iMsg)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [user] [message]");
    if(!IRC_IsUserOnChannel(groupID, IRC_CHANNEL, iUser))
    {
    format(string, sizeof(string), "* The name '%s' is not currently connected to the IRC channel.", iUser);
    SendClientMessage(playerid, COLOR_RED, string);
    }
    else
    {
    format(string, sizeof(string), "* Your message has been sent to %s", iUser);
    SendClientMessage(playerid, COLOR_RED, string);
    format(string, sizeof(string), "* PM from %s [%d]: %s", ReturnPlayerName(playerid), playerid, iMsg);
    IRC_Notice(groupID, iUser, string);
    }
I always get even if i type all params correctly.
try to change to this

Код:
new iUser, iMsg[ 128 ];
	if( sscanf ( params, "us", iUser, iMsg))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)