warning by sscanf
#1

sscanf warning: Strings without a length are deprecated, please add a destination size.

Even tho i have set the string size..
Also my messages wont show up if there longer then lets say 20 characters, i cant type a full sentence i have to split it up.
the code is shown below, i have set the lenghts right?

Код:
CMD:a(playerid,params[])
{
	new aText[128],aName[MAX_PLAYER_NAME],string[128];
	if(sscanf(params,"s",aText)) return SendClientMessage(playerid,COLOR_WHITE,"{ff387a}[Syntax]:{ffffff} ''/a [text]''.");
	if(pData[playerid][Admin] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{ff0000}[Error]:{ffffff} You are not an Administrator with the required level.");
	GetPlayerName(playerid,aName,sizeof(aName));
	format(string,sizeof(string),"{ff387a}[Admin] {ffffff}%s: %s",aName,aText);
	SendClientMessageToAdmins(COLOR_WHITE,string);
	return 1;
}
Reply
#2

Код:
if(sscanf(params,"s[128]",aText)) return SendClientMessage(playerid,COLOR_WHITE,"{ff387a}[Syntax]:{ffffff} ''/a [text]''.");
Reply
#3

omg, i did not see that, is a sscanf string not set lenght by default?
Reply
#4

Quote:
Originally Posted by yvoms
Посмотреть сообщение
omg, i did not see that, is a sscanf string not set lenght by default?
Old include that was written in pawn yes, but since plugin release no.
Reply
#5

ah i see thanks for the help tho!
Reply
#6

If you are using cmd only with one argument and this argument is string you don't need sscanf, params is your atext
pawn Код:
CMD:a(playerid,params[])
{
    if(pData[playerid][Admin] == 0) return SendClientMessage(playerid,COLOR_WHITE,"{ff0000}[Error]:{ffffff} You are not an Administrator with the required level.");
    if(isnull(params)) return SendClientMessage(playerid,COLOR_WHITE,"{ff387a}[Syntax]:{ffffff} ''/a [text]''.");

    new aName[MAX_PLAYER_NAME],string[145];
    GetPlayerName(playerid,aName,sizeof(aName));
    format(string,sizeof(string),"{ff387a}[Admin] {ffffff}%s: %s",aName,params);
    SendClientMessageToAdmins(COLOR_WHITE,string);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)