Hello guys, i need your help here... How can i set a house interior with this script code? And to change the level if possible... Thank you
Code:
CMD:hedit(playerid, params[])
{
new bizid, string[128], input;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4 && !PlayerInfo[playerid][pHouseMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
// if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
if(sscanf(params, "s[32]", params))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit [option] [houseid]");
SendClientMessage(playerid, COLOR_GREY, "OPTIONS: location | price | level");
return 1;
}
if(!strcmp(params, "location", true, 8))
{
if(sscanf(params, "s[32]i", params, bizid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hedit location [house]");
new idx = bizid;
if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
GetPlayerPos(playerid, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]);
DestroyDynamicPickup(HouseInfo[idx][hPickup]);
HouseInfo[idx][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ], 0);
DestroyDynamic3DTextLabel(HouseInfo[idx][hText]);
if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]
"COE"Owner"CWE" %s
"COE"Status"CWE" For Sale
"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]
"COE"Owner"CWE" %s
"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
HouseInfo[idx][hText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseInfo[idx][hX], HouseInfo[idx][hY], HouseInfo[idx][hZ]+0.3, 15);
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has changed house ID %d\'s location.", RPN(playerid), bizid);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/house.log", string);
}
else if(!strcmp(params, "price", true, 5))
{
if(PlayerInfo[playerid][pAdmin] < 4 && !PlayerInfo[playerid][pHouseMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house price [house] [price]");
new idx = bizid;
if(!HouseInfo[idx][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
if(strcmp("The State", HouseInfo[bizid][hOwner])) return SendClientMessage(playerid, COLOR_GREY, "You can\'t edit the price of owned businesses.");
HouseInfo[bizid][hPrice] = input;
format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]
"COE"Owner"CWE" %s
"COE"Status"CWE" For Sale
"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set house ID %d\'s price to $%d.", RPN(playerid), bizid, input);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/house.log", string);
}
else if(!strcmp(params, "level", true, 5))
{
if(PlayerInfo[playerid][pAdmin] < 4 && !PlayerInfo[playerid][pHouseMod]) return SendClientMessage(playerid, COLOR_GREY, "You are not an authorized to use this command.");
if(sscanf(params, "s[32]ii", params, bizid, input)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /house level [houseid] [level]");
new idx = bizid;
//if(!HouseInfo[bizid][hLevel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid house id.");
if(input < 1 || input > 11) return SendClientMessage(playerid, COLOR_GREY, "Levels are between 1 and 11.");
HouseInfo[bizid][hLevel] = input;
if(!strcmp("The State", HouseInfo[idx][hOwner])) format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]
"COE"Owner"CWE" %s
"COE"Status"CWE" For Sale
"CWE"$%d", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], HouseInfo[idx][hPrice]);
else format(string, sizeof(string), ""COE"["CWE"%d, House (Lvl: %d)"COE"]
"COE"Owner"CWE" %s
"COE"Status"CWE" %s", idx, HouseInfo[idx][hLevel], HouseInfo[idx][hOwner], RHS(idx));
UpdateDynamic3DTextLabelText(HouseInfo[bizid][hText], COLOR_WHITE, string);
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has set house ID %d\'s level to %d.", RPN(playerid), bizid, input);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/house.log", string);
}
return 1;
}