29.03.2011, 19:23
Im getting this error form sscanf whenever i use my warn command.
[15:24:45] sscanf warning: Strings without a length are deprecated, please add a destination size.
Command:
[15:24:45] sscanf warning: Strings without a length are deprecated, please add a destination size.
Command:
pawn Код:
COMMAND:warn(playerid,params[])
{
new pId;
if(playerdata[playerid][level] < 2) return 0;
else if(sscanf(params, "ds", pId,params[2])) return SendClientMessage(playerid, yellow, "Usage: /warn [ID] [Reason]");
else if(!IsPlayerConnected(pId)) return SendClientMessage(playerid, red, "The ID You Entered Was Not Found.");
else
{
new pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];
new string[256], string2[256];
GetPlayerName(playerid, pName,sizeof(pName));
GetPlayerName(pId,pName2,sizeof(pName2));
if(playerdata[pId][Warns]==3)
{
new query[300], ban[150];
format(string,sizeof(string),"[ADMIN]: %s(%d) Has Warned %s(%d).",pName,playerid,pName2,pId);
format(string2,sizeof(string2),"SERVER: %s(%d) Has Been Banned From The Server. Reason: 4/3 Warnings",pName2,pId);
format(query,sizeof(query),"UPDATE `accounts` SET `BanReason`='4/3 Warnings' WHERE name='%s'",pName2);
playerdata[playerid][Banned]=1;
format(ban,sizeof(ban),"UPDATE `accounts` SET `Banned`= 1, `Warns`=0 WHERE name = '%s'",pName2);
mysql_query(ban);
mysql_query(query);
SendClientMessageToAdmins(orange,string);
SendClientMessageToAll(skyblue,string2);
Save(playerid);
Kick(pId);
}
else if(playerdata[pId][Warns]==2)
{
playerdata[pId][Warns]=3;
format(string,sizeof(string),"[ADMIN]: %s (%d) Has Warned %s (%d).",pName,playerid,pName2,pId);
format(string2,sizeof(string2),"%s (%d) Has Been Warned For: %s ! 3/3 Warnings",pName2,pId,params[2]);
SendClientMessageToAdmins(orange,string);
SendClientMessageToAll(skyblue,string2);
new ban[100];
format(ban,sizeof(ban),"UPDATE `accounts` SET `Warns`= 3 WHERE name = '%s'",pName2);
mysql_query(ban);
}
else if(playerdata[pId][Warns]==1)
{
playerdata[pId][Warns]=2;
format(string,sizeof(string),"[ADMIN]: %s (%d) Has Warned %s (%d).",pName,playerid,pName2,pId);
format(string2,sizeof(string2),"%s (%d) Has Been Warned For: %s ! 2/3 Warnings",pName2,pId,params[2]);
SendClientMessageToAdmins(orange,string);
SendClientMessageToAll(skyblue,string2);
new ban[100];
format(ban,sizeof(ban),"UPDATE `accounts` SET `Warns`= 2 WHERE name = '%s'",pName2);
mysql_query(ban);
}
else if(playerdata[pId][Warns]==0)
{
playerdata[pId][Warns]=1;
format(string,sizeof(string),"[ADMIN]: %s (%d) Has Warned %s (%d).",pName,playerid,pName2,pId);
format(string2,sizeof(string2),"%s (%d) Has Been Warned For: %s ! 1/3 Warnings",pName2,pId,params[2]);
SendClientMessageToAdmins(orange,string);
SendClientMessageToAll(skyblue,string2);
new ban[100];
format(ban,sizeof(ban),"UPDATE `accounts` SET `Warns`= 1 WHERE name = '%s'",pName2);
mysql_query(ban);
}
}
return 1;
}