PDA

View Full Version : sscanf warning


Kingunit
27/08/2011, 07:57 PM
Hello,

In my console I'm getting this message when I'm doing some commands:

sscanf warning: Format specifier does not match parameter count


Example of one of the codes:

//-----[Slap]-----
CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_RED,"You aren't admin.");
new targetid;
if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: [PlayerID]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected");
else
{
new Float:SLX, Float:SLY, Float:SLZ;
GetPlayerPos(targetid, SLX, SLY, SLZ);
SetPlayerPos(targetid, SLX, SLY, SLZ+5);
PlayerPlaySound(targetid, 1130, SLX, SLY, SLZ+5);
new string[128];
new pName[24], pTame[24];
GetPlayerName(playerid,pName,24);
GetPlayerName(targetid,pTame,24);
format(string,sizeof string,""#COL_ORANGE"%s has been slapped by Administrator %s.",pTame,pName);
SendClientMessageToAll(COLOR_RED, string);
}
return 1;
}

Kush
27/08/2011, 08:00 PM
Hello,

In my console I'm getting this message when I'm doing some commands:

sscanf warning: Format specifier does not match parameter count


Example of one of the codes:

//-----[Slap]-----
CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_RED,"You aren't admin.");
new targetid;
if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: [PlayerID]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected");
else
{
new Float:SLX, Float:SLY, Float:SLZ;
GetPlayerPos(targetid, SLX, SLY, SLZ);
SetPlayerPos(targetid, SLX, SLY, SLZ+5);
PlayerPlaySound(targetid, 1130, SLX, SLY, SLZ+5);
new string[128];
new pName[24], pTame[24];
GetPlayerName(playerid,pName,24);
GetPlayerName(targetid,pTame,24);
format(string,sizeof string,""#COL_ORANGE"%s has been slapped by Administrator %s.",pTame,pName);
SendClientMessageToAll(COLOR_RED, string);
}
return 1;
}



CMD:slap(playerid, params[])
{
if(PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_RED,"You aren't admin.");
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /slap [PlayerID]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Player not connected");
new Float:SLX, Float:SLY, Float:SLZ;
GetPlayerPos(targetid, SLX, SLY, SLZ);
SetPlayerPos(targetid, SLX, SLY, SLZ+5);
PlayerPlaySound(targetid, 1130, SLX, SLY, SLZ+5);
new string[128];
new pName[24], pTame[24];
GetPlayerName(playerid,pName,24);
GetPlayerName(targetid,pTame,24);
format(string,sizeof string,""#COL_ORANGE"%s has been slapped by Administrator %s.",pTame,pName);
SendClientMessageToAll(COLOR_RED, string);
return 1;
}

Kingunit
27/08/2011, 08:02 PM
So the "uz" need to be changed to "u". Let me check if it works.

Kingunit
27/08/2011, 08:07 PM
Yes it works. Thank you, both repped+