Error in a command
#1

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


Код:
COMMAND:label(playerid,params[])
{
if (APlayerData[playerid][PlayerLevel] >= 7)
{
new string[160],Float: X, Float: Y, Float: Z,text[100],distance,color;
GetPlayerPos(playerid, X,Y,Z);
if(sscanf(params,"sxd",text,color,distance)) return SendClientMessage(playerid,0xFB9204FF,"USAGE: /label [text] [color] [distance]");
Create3DTextLabel(text,color,X,Y,Z,distance,GetPlayerVirtualWorld(playerid));
format(string,sizeof(string),"Create3DTextLabel(\"%s\",color,%f, %f, %f,%d,%d);",text,X,Y,Z,distance,GetPlayerVirtualWorld(playerid));
SaveToLog("labels",string);
}
return 1;
}
Reply
#2

pawn Код:
if(sscanf(params,"s[30]xd",
30 = just example
You forgot to string sscanf!
Reply
#3

Plz send full code.gave me errors.
Reply
#4

Read my comment! // s[30] You for got to set how big is string in sscanf! (30 is just example!)
pawn Код:
COMMAND:label(playerid,params[])
{
    if (APlayerData[playerid][PlayerLevel] >= 7)
    {
        new string[160],Float: X, Float: Y, Float: Z,text[100],distance,color;
        GetPlayerPos(playerid, X,Y,Z);
        if(sscanf(params,"s[30]xd",text,color,distance)) return SendClientMessage(playerid,0xFB9204FF,"USAGE: /label [text] [color] [distance]"); // s[30] You for got to set how big is string in sscanf! (30 is just example!)
        Create3DTextLabel(text,color,X,Y,Z,distance,GetPlayerVirtualWorld(playerid));
        format(string,sizeof(string),"Create3DTextLabel(\"%s\",color,%f, %f, %f,%d,%d);",text,X,Y,Z,distance,GetPlayerVirtualWorld(playerid));
        SaveToLog("labels",string);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)