26.01.2011, 18:58
I just converted all my commands to zcmd, before i used the stock
/pm command from the 'base' FS included with the server dowload package,
i found here on the forum this code from Sergei
The problem is when i execute the command ingame with only /pm, it shows me both warning messages,
the USAGE and "you cannot pm yourself", also when i do /pm 0 text, hapens the same but this time
sscanf prints a warning to the logs:
Could someone take a look at the script and tell me whats wrong there?
Thanks, regards.
/pm command from the 'base' FS included with the server dowload package,
i found here on the forum this code from Sergei
pawn Code:
CMD:pm(playerid, params[])
{
new str[128],id,pname[MAX_PLAYER_NAME];
if(sscanf(params, "us", id, params)) SendClientMessage(playerid, ADMINFS_MESSAGE_COLOR, "Usage: /pm <id> <message>");
else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, ADMINFS_MESSAGE_COLOR, "ERROR: Player not connected");
if(playerid == id) SendClientMessage(playerid, ADMINFS_MESSAGE_COLOR, "ERROR: You cannot pm yourself!");
else
{
GetPlayerName(id, str, 24);
format(str, sizeof(str), "PM To %s(ID %d): %s", str, id, params);
GetPlayerName(id, str, 24);
format(str, sizeof(str), "PM To %s(ID %d): %s", str, id, params);
SendClientMessage(playerid, 0xFF0000FF, str);
GetPlayerName(playerid, pname, sizeof(pname));
format(str, sizeof(str), "PM From %s(ID %d): %s", pname, playerid, params);
SendClientMessage(id, 0xFF0000FF, str);
}
return 1;
}
the USAGE and "you cannot pm yourself", also when i do /pm 0 text, hapens the same but this time
sscanf prints a warning to the logs:
Code:
[20:51:01] sscanf warning: Strings without a length are deprecated, please add a destination size.
Thanks, regards.