01.07.2014, 14:34
PHP код:
//==============================================================================
dcmd_house(playerid, params[])
{
#pragma unused params
if (PlayerInfo[playerid][pSpawn] > 0){
new Houseid = PlayerInfo[playerid][pLastOutSideID];
new string[256];
if (GetPlayerVirtualWorld(playerid) > 0 && HouseInfo[Houseid][h_cptype] == CP_TYPE_HOUSE)
{
//format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s~n~~w~For Sale ~g~$%d",HouseInfo[Houseid][h_HouseName],HouseInfo[Houseid][h_OwnerName],HouseInfo[Houseid][h_Value]);
//format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s~n~~w~Property Value ~g~$%d",HouseInfo[Houseid][h_HouseName],HouseInfo[Houseid][h_OwnerName],HouseInfo[Houseid][h_Value]);
if (HouseData[Houseid][h_OwnerID] > -1)
{
//If Playerid is Owner
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_OWNER_OPTIONS,"~g~House Owner", 12, 0);
//if (HouseData[Houseid][h_ForSale] == 0)format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s~n~~w~For Sale ~g~$%d",HouseInfo[Houseid][h_HouseIntName],HouseData[Houseid][h_OwnerName],HouseData[Houseid][h_Value]);
//else format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s",HouseInfo[Houseid][h_HouseIntName],HouseData[Houseid][h_OwnerName]);
format(string, sizeof(string), "~p~%s",HouseInfo[Houseid][h_HouseIntName]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", "~y~1 ~w~- Details", " ",0);
ShowTextDrawMenuItems(playerid, 4, " ", "~y~2 ~w~- Storage", " ",0);
ShowTextDrawMenuItems(playerid, 5, " ", "~y~3 ~w~- Set Name", " ",0);
ShowTextDrawMenuItems(playerid, 6, " ", "~y~4 ~w~- Set Price", " ",0);
ShowTextDrawMenuItems(playerid, 7, " ", "~y~5 ~w~- Set Rent", " ",0);
ShowTextDrawMenuItems(playerid, 8, " ", "~y~6 ~w~- Set Lock", " ",0);
ShowTextDrawMenuItems(playerid, 9, " ", "~y~7 ~w~- Set Alarm", " ",0);
ShowTextDrawMenuItems(playerid, 10, " ", "~y~8 ~w~- Sell House", " ",0);
}else{
//If Playerid is not Owner
//if (HouseData[Houseid][h_Rent] == 0)
//{
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_MAIN_OPTIONS,"~g~House", 8, 2);
if (HouseData[Houseid][h_ForSale] == 0)format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s~n~~w~For Sale ~g~$%d",HouseInfo[Houseid][h_HouseIntName],HouseData[Houseid][h_OwnerName],HouseData[Houseid][h_Value]);
else format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s",HouseInfo[Houseid][h_HouseIntName],HouseData[Houseid][h_OwnerName]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 4, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 5, " ", "~y~1 ~w~- House Details", " ",0);
ShowTextDrawMenuItems(playerid, 6, " ", "~y~2 ~w~- House Storage", " ",0);
/*}else{
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_MAIN_OPTIONS,"~g~House", 8, 2);
format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s~n~~w~For Rent ~g~$%d ~w~/ Day",HouseInfo[Houseid][h_HouseIntName],HouseData[Houseid][h_OwnerName],HouseData[Houseid][h_Rent]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 4, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 5, " ", "~y~1 ~w~- House Details", " ",0);
ShowTextDrawMenuItems(playerid, 6, " ", "~y~2 ~w~- House Storage", " ",0);
}*/
}
}else{
SendClientMessage(playerid, COLOR_ERROR, "You Must Be Inside A House To Use This Command.");
}
}else{
SendClientMessage(playerid, COLOR_ERROR, "You Cannot Use This Command When You're Dead.");
}
return 1;
}
PHP код:
case TD_MENU_HOUSE_OWNER_OPTIONS:
{
if (Option != -1)
{
if (Option >= 1 && Option <= Menu_Options[playerid] )
{
HideTextDrawMenu(playerid);
CP = PlayerInfo[playerid][pLastOutSideID];
switch (Option)
{
case 1://TD_MENU_HOUSE_DETAILS
{
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_MAIN_OPTIONS,"~g~House Options", 8, 0);
if (HouseData[CP][h_ForSale] == 0)format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s~n~~w~For Sale ~g~$%d",HouseInfo[CP][h_HouseIntName],HouseData[CP][h_OwnerName],HouseData[CP][h_Value]);
else format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s",HouseInfo[CP][h_HouseIntName],HouseData[CP][h_OwnerName]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 4, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 5, " ", "~y~1 ~w~- House Details", " ",0);
ShowTextDrawMenuItems(playerid, 6, " ", "~y~2 ~w~- House Storage", " ",0);
}
case 2://TD_MENU_HOUSE_STORAGE
{
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_STORAGE,"~g~House Storage", 10, 0);
format(string, sizeof(string), "~p~%s~n~~w~Owner: ~b~%s",HouseInfo[CP][h_HouseIntName],HouseData[CP][h_OwnerName]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
ShowTextDrawMenuItems(playerid, 1, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 2, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 3, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 4, " ", " ", " ",0);
ShowTextDrawMenuItems(playerid, 5, " ", "~y~1 ~w~- Store Money", " ",0);
ShowTextDrawMenuItems(playerid, 6, " ", "~y~2 ~w~- Store Drugs", " ",0);
ShowTextDrawMenuItems(playerid, 7, " ", "~y~3 ~w~- Take Money", " ",0);
ShowTextDrawMenuItems(playerid, 8, " ", "~y~4 ~w~- Take Drugs", " ",0);
}
case 3://TD_MENU_HOUSE_SET_NAME
{
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_SET_NAME,"~g~House Name", 8, 0);
format(string, sizeof(string), "House Name:~n~~p~%s~n~ ~n~~w~Press ~y~F6 ~w~(or ~y~T~w~) and Enter A New Name~n~Maximum ~b~48 ~w~Characters",HouseInfo[CP][h_HouseIntName]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
}
case 4://TD_MENU_HOUSE_SET_PRICE
{
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_SET_PRICE,"~g~House Price", 8, 0);
format(string, sizeof(string), "House Price:~n~~g~$%d~n~ ~n~~w~Press ~y~F6 ~w~(or ~y~T~w~) and Enter A House Price",HouseData[CP][h_Value]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
}
case 5://TD_MENU_HOUSE_SET_RENT
{
ShowTextDrawMenu(playerid, TD_MENU_HOUSE_SET_RENT,"~g~House Rent", 8, 0);
format(string, sizeof(string), "House Rent:~n~~g~$%d~n~ ~n~~w~Press ~y~F6 ~w~(or ~y~T~w~) and Enter A Rent Price~n~Minimum ~p~$300~w~ / Day~n~Maximum ~p~$10000~w~ / Day",HouseData[CP][h_Rent]);
ShowTextDrawMenuItems(playerid, 0, string, " ", " ",0);
}
case 6://TD_MENU_HOUSE_SET_LOCK
{
if (HouseData[CP][h_Lock] > 0)
{
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, "House Locked");
HouseData[CP][h_Lock] = 0;
}else{
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, "House UnLocked");
HouseData[CP][h_Lock] = 1;
}
}
case 7://TD_MENU_HOUSE_SET_ALARM
{
if (HouseData[CP][h_Alarm] > 0)
{
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, "House Alarm Off");
HouseData[CP][h_Alarm] = 0;
}else{
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, "House Alarm On");
HouseData[CP][h_Alarm] = 1;
}
}
case 8://TD_MENU_HOUSE_SELL
{
CP = PlayerInfo[playerid][pLastOutSideID];
if (HouseData[CP][h_RenterID] > -1)
{
new renterid = HouseData[CP][h_RenterID];
SendClientMessage(renterid, COLOR_SERVER_HELP_MSG, "Your House Rental Contract Has Been Cancelled (House Sold By Landlord).");
PlayerInfo[renterid][pHouseRent] = -1;
}
HouseData[CP][h_OwnerID] = -1;
HouseData[CP][h_RenterID] = -1;
format(string, sizeof(string), "The Bank");
strmid(HouseData[CP][h_OwnerName], string, 0, strlen(string), 256);
format(string, sizeof(string), "House");
strmid(HouseInfo[CP][h_HouseIntName], string, 0, strlen(string), 256);
TextDrawSetString(ZoneName[playerid], string);
format(string, sizeof(string), "%s In %s",HouseInfo[CP][h_HouseIntName],HouseInfo[CP][h_HouseExtName]);
strmid(PlayerInfo[playerid][pLocation], string, 0, strlen(string), 256);
format(string, sizeof(string), "None");
strmid(HouseData[CP][h_RenterName], string, 0, strlen(string), 256);
format(string, sizeof(string), "You Have Sold Your House For $%d.",HouseData[CP][h_Value]);
SendClientMessage(playerid, COLOR_SERVER_HELP_MSG, string);
format(string, sizeof(string), "~w~HOUSE SOLD FOR~n~~g~$%i",HouseData[CP][h_Value]);
GameTextForPlayer(playerid,string,5000,4);
HouseData[CP][h_Lock] = 1;
HouseData[CP][h_Alarm] = 0;
HouseInfo[CP][h_cpmarker] = 31;
PlayerInfo[playerid][pHouse] = -1;
SaveProperty(CP);
HideTextDrawMenu(playerid);
}
}
}else{
SendClientMessage(playerid, COLOR_ERROR, "Selection Cancelled.");
HideTextDrawMenu(playerid);
}
}else{
SendClientMessage(playerid, COLOR_ERROR, "Selection Cancelled.");
HideTextDrawMenu(playerid);
}
}