string buffer overflow
#1

I get this message on the console..

Code;

pawn Код:
CMD:pm(playerid, params[])
{
    new PID, message[64], pName[MAX_PLAYER_NAME], Sender[MAX_PLAYER_NAME];
    if(sscanf(params, "uz", PID, message)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /PM  [PlayerID] [Message].");
    if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "That player is not online.");
    else {
        new Str[256];
        GetPlayerName(PID, pName, sizeof(pName));
        GetPlayerName(playerid, Sender, sizeof(Sender));
        format(Str, sizeof(Str), "(( PM From: %s(%d): %s ))", Sender, playerid, message);
        SendClientMessage(PID, COLOR_YELLOW, Str);
        format(Str, sizeof(Str), "(( PM Sent: %s(%d): %s ))", pName, PID, message);
        SendClientMessage(playerid, COLOR_YELLOW, Str);
    }
    return 1;
}
Reply
#2

Try replacing the z in sscanf to s[64]
Also you don't need that else
Reply
#3

Thanks, fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)