Command error - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command error (
/showthread.php?tid=485043)
Command error -
Rien - 02.01.2014
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!
Re: Command error -
xo - 02.01.2014
try
pawn Код:
if(sscanf(params, "u", playerb))
Re: Command error -
Smileys - 02.01.2014
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.