sscanf warning. Pls help!!
#1

When i use my pm(/pm [id]) command, in the server console the following warning is coming.
pawn Код:
[11:51:55] sscanf warning: Strings without a length are deprecated, please add a destination size.
[11:51:59] sscanf warning: Strings without a length are deprecated, please add a destination size.
.

This is my pm command in gamemode.
pawn Код:
public OnPlayerPrivmsg(playerid, recieverid, text[])
{
    if(ServerInfo[ReadPMs] == 1 && AccInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
    {
//==============================================================================
// Send PM
//==============================================================================
        new string[256];
        new pReciever[MAX_PLAYER_NAME];
        GetPlayerName(playerid, string, sizeof(string));
        GetPlayerName(recieverid, pReciever, sizeof(pReciever));
        format(string, sizeof(string), "|- PM: %s To %s: %s", string, pReciever, text);
        for (new a = 0; a < MAX_PLAYERS; a++)
        if(IsPlayerConnected(a) && (AccInfo[a][Level] >= ServerInfo[MaxAdminLevel]) && a != playerid)
        Inter_SendClientMessage(a, grey, string);
        #if PM_CHAT_LOG == true
        SaveIn("AdmChatLog",string);
        #endif
    }
//==============================================================================
// Muted
//==============================================================================
    if(AccInfo[playerid][Muted] == 1)
    {
        new string[256];
        AccInfo[playerid][MuteWarnings]++;
        if(AccInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings])
        {
            format(string, sizeof(string),"|- ATTENTION: You are Muted! Cannot talk (Warnings: %d/%d) -|",AccInfo[playerid][MuteWarnings],ServerInfo[MaxMuteWarnings]);
            Inter_SendClientMessage(playerid,red,string);
        }
        else
        {
            Inter_SendClientMessage(playerid,red,"|- You have been Automatically Kicked. | Reason: Exceeding Mute Warnings -|");
            GetPlayerName(playerid, string, sizeof(string));
            format(string, sizeof(string),"|- Player %s (Id:%d) has been Automatically Kicked. | Reason: Exceeding Mute Warnings -|", string, playerid);
            Inter_SendClientMessageToAll(lightred,string);
            SaveIn("KickLog",string);
            Kick(playerid);
        }
        return 0;
    }
    #if EnablePM_Cmd == true
    new string[256],playername[MAX_PLAYER_NAME];
    format(string,sizeof(string),"|- PM: Message to '%s(%d)': \"%s\" -|",PmReceiver,PMplayer1,text);
    Inter_SendClientMessage(playerid,0x00A765AA,string);
    PlayerPlaySound(playerid,1057,0.0,0.0,0.0);

    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string),"|- PM: Message from: %s(%d): \"%s\" -|",playername,playerid,text);
    Inter_SendClientMessage(recieverid,0x00A765AA,string);
    #endif
    return 1;
}

//==============================================================================
// PM Command
//==============================================================================
#if EnablePM_Cmd == true
CMD:pm(playerid,params[])
{
    new giveplayerid, inputtext[256];
    if (sscanf(params, "us", giveplayerid, inputtext)) return Inter_SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /pm [PlayerID] [Message]");

    if(giveplayerid == playerid) return
    Inter_SendClientMessage(playerid, red, "ERROR: You can't send PM to yourself!");

    if(!(IsPlayerConnected(giveplayerid) && giveplayerid != INVALID_PLAYER_ID)) return
    Inter_SendClientMessage(playerid, red, "ERROR: Player not Connected!");
    PMplayer1 = giveplayerid;
    GetPlayerName(giveplayerid, PmReceiver, sizeof(PmReceiver));
    OnPlayerPrivmsg(playerid, giveplayerid, inputtext);
/*  new string[128];
    format(string,sizeof(string),"PM To: \"%s(%d)\" \n\nType the message to send:", PmReceiver, PMplayer1);
    ShowPlayerDialog(playerid,DIALOG_TYPE_PM,DIALOG_STYLE_INPUT,"PrivateMessage",string,"Send!","Cancel");*/

    return 1;
}
#endif
pls help me to fix this error!!

Thanks 4 de help
Reply
#2

hey somebody pls help me
Reply
#3

s[256] instead of just s
Reply
#4

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
s[256] instead of just s
can u tell where is it located?
Reply
#5

Quote:
Originally Posted by Bleach79
Посмотреть сообщение
can u tell where is it located?
Replace:

pawn Код:
if (sscanf(params, "us", giveplayerid, inputtext)) return Inter_SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /pm [PlayerID] [Message]");
With:

pawn Код:
if (sscanf(params, "us[128]", giveplayerid, inputtext)) return Inter_SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /pm [PlayerID] [Message]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)