Help me bros!
#1

Hello, bros! I have a Dynamic House System. Im going to show you only the CMD:hedit.
When i do the /hedit, the house is created, but when i create another house, it's icon goes lost. When i re-connect the server, the house it's gone, you can only /enter,/exit.
Here is the code:
Code:
CMD:hedit(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 4)
	{
		SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use that command!");
		return 1;
	}
	if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
 	{
  		SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
		return 1;
 	}

	new string[128], choice[32], houseid, amount;
	if(sscanf(params, "s[32]dD", choice, houseid, amount))
	{
		SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit [name] [houseid] [(Optional)amount]");
		SendClientMessage(playerid, COLOR_GREY, "Available names: Exterior, Interior, CustomInterior, CustomExterior, 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);
		SendClientMessage(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;
			SendClientMessage(playerid, COLOR_WHITE, "House set to custom interior!");
		}
		else
		{
			HouseInfo[houseid][hCustomInterior] = 0;
			SendClientMessage(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;
			SendClientMessage(playerid, COLOR_WHITE, "House set to custom exterior!");
		}
		else
		{
			HouseInfo[houseid][hCustomExterior] = 0;
			SendClientMessage(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]);
		SendClientMessage(playerid, COLOR_WHITE, "You have changed the exterior!");
		DestroyPickup(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)
		{
			DestroyPickup(HouseInfo[houseid][hPickupID]);
			DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
			format(string, sizeof(string), "This house is for sale!\n Level: %d\nID: %d\nPrice: $%d\nTo buy this house type /buyhouse",HouseInfo[houseid][hLevel],houseid,HouseInfo[houseid][hValue]);
			HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string, COLOR_HOUSEGREEN, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,3);
			HouseInfo[houseid][hPickupID] = CreatePickup(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
			SaveHouses();
		}
		else
		{
			if(HouseInfo[houseid][hRentable] == 0)
			{
				DestroyPickup(HouseInfo[houseid][hPickupID]);
				DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
				format(string, sizeof(string), "House owner: %s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
				HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_HOUSEGREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,3);
				HouseInfo[houseid][hPickupID] = CreatePickup(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
				SaveHouses();
			}
			else
			{
				DestroyPickup(HouseInfo[houseid][hPickupID]);
				DestroyDynamic3DTextLabel(HouseInfo[houseid][hTextID]);
				format(string, sizeof(string), "House owner: %s\nLevel: %d\nID: %d\nRent: $%d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid,HouseInfo[houseid][hRentFee]);
				HouseInfo[houseid][hTextID] = CreateDynamic3DTextLabel(string,COLOR_HOUSEGREEN,HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]+0.5,3);
				HouseInfo[houseid][hPickupID] = CreatePickup(1273, 23, HouseInfo[houseid][hExteriorX], HouseInfo[houseid][hExteriorY], HouseInfo[houseid][hExteriorZ]);
				SaveHouses();
			}
		}
	}
	else if(strcmp(choice, "level", true) == 0)
	{
		HouseInfo[houseid][hLevel] = amount;
		format(string, sizeof(string), "You have set the house level to %d.", amount);
		SendClientMessage(playerid, COLOR_WHITE, string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This house is for sale!\n Level: %d\nID: %d\nPrice: $%d\nTo buy this house type /buyhouse",HouseInfo[houseid][hLevel],houseid,HouseInfo[houseid][hValue]);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_HOUSEGREEN, string);
		}
		else
		{
			if(HouseInfo[houseid][hRentable] == 0)
			{
				format(string, sizeof(string), "House owner: %s\nLevel: %d\nID: %d",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid);
				UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_HOUSEGREEN, string);
			}
			else
			{
				format(string, sizeof(string), "House owner: %s\nLevel: %d\nID: %d\nRent: $%d\nType /rentroom to rent a room",HouseInfo[houseid][hOwner],HouseInfo[houseid][hLevel],houseid,HouseInfo[houseid][hRentFee]);
				UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_HOUSEGREEN, 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);
		SendClientMessage(playerid, COLOR_WHITE, string);
		if(HouseInfo[houseid][hOwned] ==0)
		{
			format(string, sizeof(string), "This house is for sale!\n Level: %d\nID: %d\nPrice: $%d\nTo buy this house type /buyhouse",HouseInfo[houseid][hLevel],houseid,HouseInfo[houseid][hValue]);
			UpdateDynamic3DTextLabelText(HouseInfo[houseid][hTextID], COLOR_HOUSEGREEN, 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");
				SendClientMessage(playerid, COLOR_WHITE, "You have set the house's class to 1 (Low)");
			}
		case 2:
			{
				format(HouseInfo[houseid][hDescription], 128, "Medium");
				SendClientMessage(playerid, COLOR_WHITE, "You have set the house's class to 2 (Medium)");
			}
		case 3:
			{
				format(HouseInfo[houseid][hDescription], 128, "High");
				SendClientMessage(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 for sale!\n Description: %s\nPrice: $%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_HOUSEGREEN, 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;
}
Reply
#2

Sounds like a streamer issue. Goodluck
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)