SSCANF parameter issue
#1

Код:
   // 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.
Reply
#2

You need to set default value:
pawn Код:
"s[30]I(-1)"
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)