sscanf warning
#1

When I try to create a house using /hedit it will show me these warnings

Код:
[00:42:29] sscanf warning: No default value found.
[00:42:29] sscanf warning: No default value found.
This is my /hedit command
Код:
CMD:hedit(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
		return 1;
	}

	new string[128], choice[32], houseid, amount;
	if(sscanf(params, "s[32]dD(choice)", choice, houseid, amount))
	{
		SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /hedit [name] [houseid] [(Optional)amount]");
		SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, CustomInterior, Class (1-3), Level, Price");
		return 1;
	}

	if(strcmp(choice, "interior", true) == 0)
	{
		GetPlayerPos(playerid, HouseInfo[houseid][hInteriorX], HouseInfo[houseid][hInteriorY], HouseInfo[houseid][hInteriorZ]);
		GetPlayerFacingAngle(playerid, HouseInfo[houseid][hInteriorA]);
		HouseInfo[houseid][hHInteriorWorld] = GetPlayerInterior( playerid );
		SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the interior!" );
		SaveHouses();

		format(string, sizeof(string), "%s has edited HouseID %d's Interior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		return 1;
	}
	else if(strcmp(choice, "custominterior", true) == 0)
	{
		if(HouseInfo[houseid][hCustomInterior] == 0)
		{
			HouseInfo[houseid][hCustomInterior] = 1;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom interior!" );
		}
		else
		{
			HouseInfo[houseid][hCustomInterior] = 0;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) interior!" );
		}
		SaveHouses();

		format(string, sizeof(string), "%s has edited HouseID %d's Custom Interior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		return 1;
	}
	else if(strcmp(choice, "customexterior", true) == 0)
	{
		if(HouseInfo[houseid][hCustomExterior] == 0)
		{
			HouseInfo[houseid][hCustomExterior] = 1;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to custom exterior!" );
		}
		else
		{
			HouseInfo[houseid][hCustomExterior] = 0;
			SendClientMessageEx( playerid, COLOR_WHITE, "House set to normal (not custom) exterior!" );
		}
		SaveHouses();

		format(string, sizeof(string), "%s has edited HouseID %d's Custom Exterior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		return 1;
	}
	else if(strcmp(choice, "exterior", true) == 0)
	{
		GetPlayerPos(playerid, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
		GetPlayerFacingAngle(playerid, HouseInfo[houseid][hExteriorA]);
		SendClientMessageEx( playerid, COLOR_WHITE, "You have changed the exterior!" );
		DestroyDynamicPickup(HouseInfo[houseid][hPickupID]);
		SaveHouses();

		format(string, sizeof(string), "%s has edited HouseID %d's Exterior.", GetPlayerNameEx(playerid), houseid);
		Log("logs/hedit.log", string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			DestroyDynamicPickup(HouseInfo[houseid][hPickupID]);
			DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
			format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel( string, COLOR_GREEN, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1,  -1, 30.0);
			HouseInfo[houseid][hPickupID] = CreateDynamicPickup(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
		}
		else
		{
			if(HouseInfo[houseid][hRentable] == 0)
			{
				DestroyDynamicPickup(HouseInfo[houseid][hPickupID]);
				DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
				format(string, sizeof(string), "This house is owned by\n%s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
				HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_GREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1,  -1, 30.0);
				HouseInfo[houseid][hPickupID] = CreateDynamicPickup(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
			}
			else
			{
				DestroyDynamicPickup(HouseInfo[houseid][hPickupID]);
				DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
				format(string, sizeof(string), "This house is owned by\n%s\nRent: $%d\nLevel: %d\nID: %d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hRentFee],HouseInfo[houseid][hLevel],houseid);
				HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_GREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1,  -1, 30.0);
				HouseInfo[houseid][hPickupID] = CreateDynamicPickup(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
			}
		}
	}
	else if(strcmp(choice, "level", true) == 0)
	{
		HouseInfo[houseid][hLevel] = amount;
		format(string, sizeof(string), "You have set the house level to %d.", amount);
		SendClientMessageEx(playerid, COLOR_WHITE, string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
		}
		else
		{
			if(HouseInfo[houseid][hRentable] == 0)
			{
				format(string, sizeof(string), "This house is owned by\n%s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
				UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
			}
			else
			{
				format(string, sizeof(string), "This house is owned by\n%s\nRent: $%d\nLevel: %d\nID: %d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hRentFee],HouseInfo[houseid][hLevel],houseid);
				UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
			}
		}
		format(string, sizeof(string), "%s has edited HouseID %d's Level to %d.", GetPlayerNameEx(playerid), houseid, amount);
		Log("logs/hedit.log", string);
	}
	else if(strcmp(choice, "price", true) == 0)
	{
		HouseInfo[houseid][hValue] = amount;
		format(string, sizeof(string), "You have set the houses price to $%d.", amount );
		SendClientMessageEx(playerid, COLOR_WHITE, string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This house is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
		}

		format(string, sizeof(string), "%s has edited HouseID %d's Price to $%d.", GetPlayerNameEx(playerid), amount);
		Log("logs/hedit.log", string);
	}
	else if(strcmp(choice, "class", true) == 0)
	{
		switch(amount)
		{
			case 1:
			{
				format(HouseInfo[houseid][hDescription], 128, "Low" );
				SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 1 (Low)" );
			}
			case 2:
			{
				format(HouseInfo[houseid][hDescription], 128, "Medium" );
				SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 2 (Medium)" );
			}
			case 3:
			{
				format(HouseInfo[houseid][hDescription], 128, "High" );
				SendClientMessageEx(playerid, COLOR_WHITE, "You have set the house's class to 3 (High)" );
			}
		}
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This home is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\nID: %d\nTo buy this house type /buyhouse",HouseInfo[houseid][hDescription],HouseInfo[houseid][hValue],HouseInfo[houseid][hLevel],houseid);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_GREEN, string);
		}

		format(string, sizeof(string), "%s has edited HouseID %d's Class to %d.", GetPlayerNameEx(playerid), houseid, amount);
		Log("logs/hedit.log", string);
	}
	SaveHouses();
	return 1;
}
Sorry if the code is too long
Reply
#2

You must set a default value for 'D(here_number)'
Reply
#3

Would 0 be good as a default value?
Reply
#4

yes you can use that
Reply
#5

Yeah thank you it worked.I would +rep both of you but I didn't reach 50 posts yet so..I can just say thank you :/
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)