problem with this cmd -
KillerStrike23 - 02.05.2014
hey I got a problem with this cmd its sends to irc that player had sends a pm but I don't show the message like this
[IRC PM] Killer(0):
pawn Код:
CMD:ircpm(playerid,params[]) {
new id, gMessage[128],Message[200],iName[MAX_PLAYER_NAME], pmName[MAX_PLAYER_NAME];
if(sscanf(params, "s", Message)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]i");
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pmName,sizeof(pmName));
format(Message,sizeof(Message),"[IRC PM] %s(%d): %s",iName,id,gMessage);
IRC_GroupSay(gGroupID, IRC_CHANNEL, Message);
SendClientMessage(playerid,green,"Pm Sent To IRC!");
// IRC_SendRaw((botid, IRC_ADMINCHANNEL, string);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
return 1;}
Re: problem with this cmd -
Eth - 02.05.2014
pawn Код:
CMD:ircpm(playerid,params[]) {
new id, gMessage[128],Message[200],iName[MAX_PLAYER_NAME], pmName[MAX_PLAYER_NAME];
if(sscanf(params, "s[39]", gMessage)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]i");
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pmName,sizeof(pmName));
format(Message,sizeof(Message),"[IRC PM] %s(%d): %s",iName,id,gMessage);
IRC_GroupSay(gGroupID, IRC_CHANNEL, Message);
SendClientMessage(playerid,green,"Pm Sent To IRC!");
// IRC_SendRaw((botid, IRC_ADMINCHANNEL, string);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
return 1;}
Re: problem with this cmd -
XK - 02.05.2014
It should be
pawn Код:
CMD:ircpm(playerid,params[]) {
new id, gMessage[128],Message[200],iName[MAX_PLAYER_NAME], pmName[MAX_PLAYER_NAME];
if(sscanf(params, "s[128]", gMessage)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]i");
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pmName,sizeof(pmName));
format(Message,sizeof(Message),"[IRC PM] %s(%d): %s",iName,id,gMessage);
IRC_GroupSay(gGroupID, IRC_CHANNEL, Message);
SendClientMessage(playerid,green,"Pm Sent To IRC!");
// IRC_SendRaw((botid, IRC_ADMINCHANNEL, string);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
return 1;}
Re: problem with this cmd -
Konstantinos - 02.05.2014
I'm sure you got a
sscanf warning: Arrays without a length are deprecated, please add a destination size to your console/server log.
I'm not sure which one you want to do. You can PM from in-game to IRC a user or send the message to all the users of the channel.
Your code sends only a message to the channel but what's the point to declare "id" which is 0 by default? That will send a message to every user I suppose (never used IRC scripts):
pawn Код:
CMD:ircpm(playerid,params[])
{
if (isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]");
new Message[144];
GetPlayerName(playerid, Message, 21);
format(Message, sizeof (Message), "[IRC PM] %s(%d): %s", Message, playerid, params);
IRC_GroupSay(gGroupID, IRC_CHANNEL, Message);
SendClientMessage(playerid, green, "Pm Sent To IRC!");
// IRC_SendRaw((botid, IRC_ADMINCHANNEL, string);
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
printf("PM: %s", params);
return 1;
}
About a specific player, you'll need more and the name of the user as the command's parameter.
Re: problem with this cmd -
Eth - 02.05.2014
mine is the working one :
pawn Код:
CMD:ircpm(playerid,params[]) {
new id, gMessage[128],Message[200],iName[MAX_PLAYER_NAME], pmName[MAX_PLAYER_NAME];
if(sscanf(params, "s[39]", gMessage)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]i");
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pmName,sizeof(pmName));
format(Message,sizeof(Message),"[IRC PM] %s(%d): %s",iName,id,gMessage);
IRC_GroupSay(gGroupID, IRC_CHANNEL, Message);
SendClientMessage(playerid,green,"Pm Sent To IRC!");
// IRC_SendRaw((botid, IRC_ADMINCHANNEL, string);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
return 1;}
let me tell you why ,First of all let's go to his old command:
as you can see here in the sscanf thing: he did Message not gMessage, and Message is just like string: so the server will thing or detect "Message" which is a string as the text .
pawn Код:
CMD:ircpm(playerid,params[]) {
new id, gMessage[128],Message[200],iName[MAX_PLAYER_NAME], pmName[MAX_PLAYER_NAME];
if(sscanf(params, "s", Message)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]i");//also up there ^ it's a text so he should write s[39] instead of s only.
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pmName,sizeof(pmName));
format(Message,sizeof(Message),"[IRC PM] %s(%d): %s",iName,id,gMessage);//here gMessage= the text that the player typed, that's why he should do mine
IRC_GroupSay(gGroupID, IRC_CHANNEL, Message);
SendClientMessage(playerid,green,"Pm Sent To IRC!");
// IRC_SendRaw((botid, IRC_ADMINCHANNEL, string);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
return 1;}
Re: problem with this cmd -
XK - 02.05.2014
Yea same for me but you posted it before me in few seconds,i tested mine too
Re: problem with this cmd -
Eth - 02.05.2014
you typed :
pawn Код:
if(sscanf(params, "s[128]", Message)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]i");
but it should be :
Код:
if(sscanf(params, "s[128]", gMessage)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ircpm [Message]i");
no matters what is the number next to the "s" thing.
Re: problem with this cmd -
XK - 02.05.2014
Nah it was a mistake i corrected it after posting...
Re: problem with this cmd -
Eth - 02.05.2014
dude you have corrected it after i told you about this mistake o.O
Re: problem with this cmd -
XK - 02.05.2014
Man stop saying shits,are you just trying to show that you are pro or what?
Everyone makes mistakes