sscanf warning
#1

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:
pawn Код:
//-----[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;
}
Reply
#2

Quote:
Originally Posted by Kingunit
Посмотреть сообщение
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:
pawn Код:
//-----[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;
}
PHP код:
CMD:slap(playeridparams[])
{
    if(
PlayerInfo[playerid][Adminlevel] < 1) return SendClientMessage(playerid,COLOR_RED,"You aren't admin.");
    new 
targetid;
    if(
sscanf(params"u"targetid)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /slap [PlayerID]");
    if(!
IsPlayerConnected(targetid)) return SendClientMessage(playeridCOLOR_WHITE"Player not connected");
    new 
Float:SLXFloat:SLYFloat:SLZ;
    
GetPlayerPos(targetidSLXSLYSLZ);
    
SetPlayerPos(targetidSLXSLYSLZ+5);
    
PlayerPlaySound(targetid1130SLXSLYSLZ+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_REDstring);
    return 
1;

Reply
#3

So the "uz" need to be changed to "u". Let me check if it works.
Reply
#4

Yes it works. Thank you, both repped+
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)