Command error
#1

Recenlty i've created an command(NOT FINISHED) but they display this error in console :
Код:
[20:37:29] sscanf warning: Format specifier does not match parameter count.
Код:
CMD:medic(playerid, params[])
{
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
   	if(!IsAParamedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an medic.");	
	if(sscanf(params,"s[32]", params))
	{
	    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /medic [action]");
	    SendClientMessage(playerid, COLOR_GREY, "SERVICES: accept | cancel");
	    return 1;
	}
	if(!strcmp(params, "accept", true))
	{
	    new playerb, string[250];
	    if(sscanf(params, "uis[64]", playerb)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /medic accept [playerid]");		
	    if(PlayerInfo[playerb][pMedicRequest] == 0) return SendClientMessage(playerid, COLOR_GREY, "This men dosen't need your service.");
        format(string, sizeof(string), "%s has accepted your medic call.Please stay at your position.",NORPN(playerid));		
		SendClientMessage(playerb,COLOR_LIGHTGREEN,string);		
		SendClientMessage(playerb,COLOR_LIGHTGREEN,"If you don't medic anymore type /cancel medic.");				
		return 1;
	}
		if(!strcmp(params, "cancel", true))
	{		
        PlayerInfo[playerid][pMedicRequest] = 0;
		return 1;
	}
	return 1;
}
+REP FOR PERSON WHO HELP ME!
Reply
#2

try
pawn Код:
if(sscanf(params, "u", playerb))
Reply
#3

you shouldn't use sscanf that way.

pawn Код:
CMD:medic(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsAParamedic(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an medic.");   
    new playerb, string[ 35 ];
    if( sscanf( params, "us[35]", playerb, string ) )
    {
        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /medic [playerid] [action]");
        SendClientMessage(playerid, COLOR_GREY, "ACTIONS: accept | cancel");
        return 1;
    }
    if(!strcmp(string, "accept", true))
    {
        if(PlayerInfo[playerb][pMedicRequest] == 0) return SendClientMessage(playerid, COLOR_GREY, "This men dosen't need your service.");
        format(string, sizeof(string), "%s has accepted your medic call.Please stay at your position.",NORPN(playerid));       
        SendClientMessage(playerb,COLOR_LIGHTGREEN,string);    
        SendClientMessage(playerb,COLOR_LIGHTGREEN,"If you don't medic anymore type /cancel medic.");              
        return 1;
    }
    if(!strcmp(string, "cancel", true))
    {      
        PlayerInfo[playerid][pMedicRequest] = 0;
        return 1;
    }
    return 1;
}
untested, but it should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)