02.04.2013, 08:00
Hello, this is giving me : sscanf warning: Strings without a length are deprecated, please add a destination size.
I tryed with this if(sscanf(params, "s[37]", sP)) return SendClientMessage(playerid, -1, "USAGE: /createacc [NAME_SURNAME]");
but then when I do /createacc Test_Test it gives me an error
The command works fine but I want to get rid of the warning.
pawn Код:
LEANCMD:(createacc)
{
new
sP[MAX_PLAYER_NAME + 1],
sV[34 + 1],
fString[256];
if(!(PlayerInfo[playerid][pAdmin] >= 3)) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
if(sscanf(params, "s", sP)) return SendClientMessage(playerid, -1, "USAGE: /createacc [NAME_SURNAME]");
if(strlen(sP) < 3 || strlen(sV) > MAX_PLAYER_NAME) return SendClientMessage(playerid, -1, "ERROR: Invalid name lenghth");
new sendername[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(fString, sizeof fString, "Users/%s.ini", sP);
new INI:File = INI_Open(fString);
INI_SetTag(File, "data");
INI_WriteInt(File,"Password",udb_hash("changeit"));
INI_WriteInt(File, "Cash", 0);
INI_WriteInt(File, "Admin", 0);
INI_WriteInt(File, "Kills", 1);
INI_WriteInt(File, "Deaths", 1);
INI_WriteInt(File, "Skin", 266);
INI_WriteInt(File, "Logs", 1);
INI_WriteInt(File, "Banned", 0);
INI_WriteInt(File, "Crim", 0);
INI_WriteInt(File, "Pw", 0);
INI_Close(File);
SendClientMessage(playerid, -1, "Account created!");
format(string,sizeof(string), "AdmWarn: Admin[%i] %s has created an account with the name: %s",PlayerInfo[playerid][pAdmin], sendername, sP);
SendAdminMessage(COLOR_YELLOW, string);
format(string,sizeof(string),"[%d-%d-%d] AdmWarn: Admin[%i] %s has created an account with the name: %s",GetDay(),GetMonth(),GetYear(),PlayerInfo[playerid][pAdmin],sendername, sP);
Log("/logs/Accounts.txt",string);
return 1;
}
I tryed with this if(sscanf(params, "s[37]", sP)) return SendClientMessage(playerid, -1, "USAGE: /createacc [NAME_SURNAME]");
but then when I do /createacc Test_Test it gives me an error
The command works fine but I want to get rid of the warning.