need help with /pm command using zcmd & sscanf
#1

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

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 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:
Code:
[20:51:01] sscanf warning: Strings without a length are deprecated, please add a destination size.
Could someone take a look at the script and tell me whats wrong there?
Thanks, regards.
Reply


Messages In This Thread
need help with /pm command using zcmd & sscanf - by OldDirtyBastard - 26.01.2011, 18:58
Re: need help with /pm command using zcmd & sscanf - by OldDirtyBastard - 26.01.2011, 19:42
Re: need help with /pm command using zcmd & sscanf - by Alex_Valde - 26.01.2011, 19:46
Re: need help with /pm command using zcmd & sscanf - by OldDirtyBastard - 26.01.2011, 19:59

Forum Jump:


Users browsing this thread: 1 Guest(s)