SSCANF parameter issue - 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: SSCANF parameter issue (
/showthread.php?tid=655311)
SSCANF parameter issue -
Stefhan - 18.06.2018
Код:
// Set myskin
else if(strmatch(subcommand, "myskin")) {
if(sscanf(params, "s[30]I", subcommand, value))
return SendClientMessage(playerid, COLOR_SERVER, "SERVER: {A7A7A7}/set myskin [skin]");
if(value == -1)
{
DestroySelectionMenu(playerid);
SetPVarInt(playerid, "skinc_active", 1);
CreateSelectionMenu(playerid);
SelectTextDraw(playerid, 0xACCBF1FF);
}
else if(value < 0 || value > 25000)
return SendClientMessage(playerid, COLOR_SERVER, "SERVER: {A7A7A7}You can only use a value between {FFFFFF}0{A7A7A7} and {FFFFFF}25000{A7A7A7}.");
SetPlayerSkin(playerid,value);
setskin[playerid] = 1;
skinupdate[playerid] = 1;
format(str,sizeof(str), "SERVER: {A7A7A7}You have set your skin ID to {FFFFFF}%i{A7A7A7}.", value);
return SendClientMessage(playerid, COLOR_SERVER, str);
}
Hello. Basically, I have an issue with the value.
What I want to happen is, if you enter no value, you get the selectionmenu, but if you enter a value, you don't get the menu, but the skin ID that was selected straight away.
The issue I have is that if I do "/set myskin" the menu doesn't pop up, and it just sets my skin to something random like 17038.
Re: SSCANF parameter issue -
Calisthenics - 18.06.2018
You need to set default value:
Re: SSCANF parameter issue -
GTLS - 18.06.2018
Set default value to INVALID_SKIN_ID and check, if ID is not invalid, set it to the number entered else show the invalid ID or what ever message you want.