15.06.2010, 10:54
Hey guys, +1 to my failure count
This time,I created a /pm command.
It fails.
Well,code:
Well the fail in here is that whenever I send a PM to a player,he only see the first word I've typed.
E.X If i type "/pm 1 hello how are you?" the player only see "hello".
I've tried to inlarge the strings,still same problem.
Any help appreciated.
This time,I created a /pm command.
It fails.
Well,code:
pawn Код:
if(strcmp(cmd, "/pm", true) == 0)
{
new name[24],mString1[126],mString2[126],n300[24];
GetPlayerName(playerid,name,24);
tmp = strtok(cmdtext, idx);
message = strrest(cmdtext, idx);
if(strlen(tmp) == 0 || strlen(message) == 0) return SendClientMessage(playerid, RedCol, "USAGE: /pm [playerid] [message]");
else if(!IsNumeric(tmp)) return SendClientMessage(playerid,RedCol,"ERROR: Invalid player ID.");
else if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid,RedCol,"ERROR: Player is not connected.");
else if(strval(tmp) == playerid) return SendClientMessage(playerid,RedCol,"ERROR: You cannot PM yourself.");
else
{
format(mString1,126,"Message from %s(%d): %s",name,playerid,message);
SendClientMessage(strval(tmp),YellowCol,mString1);
GetPlayerName(strval(tmp),n300,24);
format(mString2,126,"Message succesfully sent to %s.",n300);
SendClientMessage(playerid,Yellow2Col,mString2);
}
return 1;
}
E.X If i type "/pm 1 hello how are you?" the player only see "hello".
I've tried to inlarge the strings,still same problem.
Any help appreciated.