Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Dynamic House Creator v.1 by California!
- * With this script, you have the ability to create a house anywhere you like.
- * You may also set the house name, description, entrance and interior.
- * You can also enter, exit, lock, sell and buy a house.
- * You can also store cash in your safe.
- * If you have any questions, feel free to message me.
- * EDIT: Updated last at January 8, 2011.
- */
- // Includes
- #include <a_samp>
- #include <dini>
- // Variables
- new HousePickup[MAX_PLAYERS];
- new HouseCar[MAX_PLAYERS];
- new HouseUser[MAX_PLAYERS];
- new Text3D:HouseLabel[MAX_PLAYERS];
- // Is player house owner?
- new bool:HouseOwner[MAX_PLAYERS];
- // Is player setting up house entrance?
- new bool:SettingUpEntrance[MAX_PLAYERS];
- // Is player setting up house?
- new bool:IsSettingUpHouse[MAX_PLAYERS];
- // Is player setting up vehicle?
- new bool:IsSettingUpVehicle[MAX_PLAYERS];
- new bool:IsUpgradingVehicle[MAX_PLAYERS];
- // Has player already setup?
- new bool:HasAlreadySetupName[MAX_PLAYERS];
- new bool:HasAlreadySetupDesc[MAX_PLAYERS];
- new bool:HasAlreadySetupEntrance[MAX_PLAYERS];
- new bool:HasAlreadySetupInterior[MAX_PLAYERS];
- new bool:HasAlreadySetupRentable[MAX_PLAYERS];
- new bool:HasAlreadySetupRentPrice[MAX_PLAYERS];
- new bool:HasAlreadySetupCar[MAX_PLAYERS];
- // Rent info.
- new bool:IsRentingHouse[MAX_PLAYERS];
- // Approve status.
- new bool:IsApprovalPending[MAX_PLAYERS];
- // Used later on to store the information into the house variables.
- enum SetupHome
- {
- SetupName[24],
- SetupDesc[32],
- SetupOwner[24],
- SetupPrice,
- Float:SetupPX,
- Float:SetupPY,
- Float:SetupPZ,
- Float:SetupTX,
- Float:SetupTY,
- Float:SetupTZ,
- Float:SetupTA,
- SetupInt,
- SetupVir,
- SetupRentable,
- SetupRentPrice,
- Float:SetupCarX,
- Float:SetupCarY,
- Float:SetupCarZ,
- Float:SetupCarRot,
- SetupCarModel
- };
- new SetupHouseInfo[MAX_PLAYERS][SetupHome];
- // The house enum, contains a lot of house shit.
- enum Home
- {
- Name[64],
- Desc[64],
- Owner[24],
- Price,
- Float:PX,
- Float:PY,
- Float:PZ,
- Float:TX,
- Float:TY,
- Float:TZ,
- Float:TA,
- Cash,
- Int,
- Vir,
- Locked,
- Rentable,
- RentPrice,
- Float:CarX,
- Float:CarY,
- Float:CarZ,
- Float:CarRot,
- CarModel
- };
- new HouseInfo[14][Home];
- // Called when a player disconnects.
- public OnPlayerDisconnect(playerid)
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new pname[MAX_PLAYER_NAME], file[100];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(file, sizeof(file), "Houses/%s.ini", pname);
- if(dini_Exists(file))
- {
- dini_Set(file, "Owner", pname);
- dini_FloatSet(file, "Pickup X", HouseInfo[h][PX]);
- dini_FloatSet(file, "Pickup Y", HouseInfo[h][PY]);
- dini_FloatSet(file, "Pickup Z", HouseInfo[h][PZ]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_IntSet(file, "Interior", HouseInfo[h][Int]);
- dini_IntSet(file, "Virtual", HouseInfo[h][Vir]);
- dini_IntSet(file, "Cash", HouseInfo[h][Cash]);
- dini_IntSet(file, "Rentable", HouseInfo[h][Rentable]);
- dini_IntSet(file, "Rent Price", HouseInfo[h][RentPrice]);
- dini_IntSet(file, "Car Model", HouseInfo[h][CarModel]);
- dini_FloatSet(file, "Car X", HouseInfo[h][CarX]);
- dini_FloatSet(file, "Car Y", HouseInfo[h][CarY]);
- dini_FloatSet(file, "Car Z", HouseInfo[h][CarZ]);
- dini_FloatSet(file, "Car Rotation", HouseInfo[h][CarRot]);
- DestroyPickup(HousePickup[playerid]);
- Delete3DTextLabel(HouseLabel[playerid]);
- for(new i; i<MAX_PLAYERS; i++)
- {
- RemovePlayerMapIcon(i, HouseUser[playerid]);
- }
- return 1;
- }
- }
- return 1;
- }
- // Called when a player connects.
- public OnPlayerConnect(playerid)
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new pname[MAX_PLAYER_NAME];
- new name[256], desc[256];
- new file[100], str[128];
- GetPlayerName(playerid, pname, sizeof(pname));
- format(file, sizeof(file), "Houses/%s.ini", pname);
- if(dini_Exists(file))
- {
- name = dini_Get(file, "Name");
- desc = dini_Get(file, "Description");
- HouseInfo[h][Owner] = pname;
- HouseInfo[h][Price] = dini_Int(file, "Price");
- HouseInfo[h][PX] = dini_Float(file, "Pickup X");
- HouseInfo[h][PY] = dini_Float(file, "Pickup Y");
- HouseInfo[h][PZ] = dini_Float(file, "Pickup Z");
- HouseInfo[h][TX] = dini_Float(file, "Teleport X");
- HouseInfo[h][TY] = dini_Float(file, "Teleport Y");
- HouseInfo[h][TZ] = dini_Float(file, "Teleport Z");
- HouseInfo[h][TA] = dini_Float(file, "Teleport Angle");
- HouseInfo[h][Int] = dini_Int(file, "Interior");
- HouseInfo[h][Vir] = dini_Int(file, "Virtual");
- HouseInfo[h][Cash] = dini_Int(file, "Cash");
- HouseInfo[h][Rentable] = dini_Int(file, "Rentable");
- HouseInfo[h][RentPrice] = dini_Int(file, "Rent Price");
- HouseInfo[h][CarModel] = dini_Int(file, "Car Model");
- HouseInfo[h][CarX] = dini_Float(file, "Car X");
- HouseInfo[h][CarY] = dini_Float(file, "Car Y");
- HouseInfo[h][CarZ] = dini_Float(file, "Car Z");
- HouseInfo[h][CarRot] = dini_Float(file, "Car Rotation");
- if(HouseInfo[h][Rentable] == 0)
- {
- format(str, sizeof(str), "Name: %s\n\nDescription: %s\n\nOwner: %s", name, desc, pname);
- }
- else
- {
- format(str, sizeof(str), "Name: %s\n\nDescription: %s\n\nOwner: %s\n\nRent Price: $%i", name, desc, pname, HouseInfo[h][RentPrice]);
- }
- HouseLabel[playerid] = Create3DTextLabel(str, 0xF97804FF, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ], 20.0, 0);
- HouseOwner[playerid] = true;
- HousePickup[playerid] = CreatePickup(1273, 23, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]);
- HouseCar[playerid] = CreateVehicle(HouseInfo[h][CarModel], HouseInfo[h][CarX], HouseInfo[h][CarY], HouseInfo[h][CarZ], HouseInfo[h][CarRot], -1, -1, 5000000);
- HouseUser[playerid] = playerid;
- for(new i; i<MAX_PLAYERS; i++)
- {
- SetPlayerMapIcon(i, HouseUser[playerid], HouseInfo[h][CarX], HouseInfo[h][CarY], HouseInfo[h][CarZ], 31, MAPICON_GLOBAL);
- }
- return 1;
- }
- }
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(vehicleid == HouseCar[playerid])
- {
- if(HouseOwner[playerid] == false)
- {
- if(!ispassenger)
- {
- new Float:X, Float:Y, Float:Z;
- SendClientMessage(playerid, 0xE21F1FFF, "You don't have the keys for this vehicle!");
- GetPlayerPos(playerid, X, Y, Z);
- SetPlayerPos(playerid, X, Y, Z);
- return 1;
- }
- }
- }
- return 1;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
- // Called when a player types a command.
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[128], idx;
- cmd = strtok(cmdtext, idx);
- if(!strcmp(cmdtext, "/createhouse", true))
- { // Buying house.
- if(HouseOwner[playerid] == false)
- {
- new name, pName[MAX_PLAYER_NAME];
- name = GetPlayerName(playerid, pName, sizeof(pName));
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- IsSettingUpHouse[playerid] = true;
- SetupHouseInfo[playerid][SetupOwner] = name;
- new file[100];
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_Create(file);
- dini_Set(file, "Owner", pName);
- return 1;
- }
- }
- if(IsSettingUpHouse[playerid] == false)
- {
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You are already setting up your house.");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already own a house.");
- return 1;
- }
- return 1;
- }
- if (strcmp("/buyhouse", cmdtext, true, 10) == 0)
- {
- for(new i; i<MAX_HOUSES; i++)
- {
- if(!IsPlayerInRangeOfPoint(playerid, 3, HouseInfo[i][PickupX], HouseInfo[i][PickupY], HouseInfo[i][PickupZ])) continue;
- new Pname[24]; GetPlayerName(playerid, Pname, 24);
- for(new S; S<MAX_HOUSES; S++)
- {
- if(!strcmp(dini_Get("Owned.ini", HouseInfo[S][HouseNames]), Pname)) return SendClientMessage(playerid, 0xF60000AA, "You already have a house!");
- }
- if(GetPlayerMoney(playerid) < HouseInfo[i][HouseCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house");
- if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!");
- GivePlayerMoney(playerid, - HouseInfo[i][HouseCost]);
- GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3);
- HouseInfo[i][Owned] = 1;
- GetPlayerName(playerid, Pname, 24);
- format(HouseInfo[i][HouseOwner], 24, "%s", Pname);
- dini_Set("Owners.ini", HouseInfo[i][HouseNames], Pname);
- return 1;
- }
- SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house");
- return 1;
- }
- if(!strcmp(cmdtext, "/houseupgrade", true))
- {
- if(HouseOwner[playerid] == true)
- {
- if(listitem == 0) // Name
- {
- ShowPlayerDialog(playerid, 681, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- }
- if(listitem == 1) // Description
- {
- ShowPlayerDialog(playerid, 682, DIALOG_STYLE_INPUT, "Confirm Description", "Please type in the description of your house.\nExample: My house is the best house ever.", "Confirm", "Cancel");
- }
- if(listitem == 2) // Entrance
- {
- ShowPlayerDialog(playerid, 683, DIALOG_STYLE_MSGBOX, "Confirm Entrance", "Are you sure you want to mark your current position as the entrance to your house?", "Yes", "No");
- }
- if(listitem == 3) // Interior
- {
- ShowPlayerDialog(playerid, 684, DIALOG_STYLE_LIST, "Confirm Interior", "Trailer ($7500)\nRyder's Crib ($9000)\nCJ's Crib ($10000)\nSweet's Crib ($12500)\nFancy Crib ($20000)\nWillowfield Safehouse ($25000)\nMansion ($500,000)\nMadd Dogg's Mansion ($1,000,000)\nCrack Palace ($2,500,000)", "Buy", "Cancel");
- }
- if(listitem == 4) // Vehicle
- {
- ShowPlayerDialog(playerid, 688, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- }
- if(listitem == 5) // Rent
- {
- ShowPlayerDialog(playerid, 685, DIALOG_STYLE_LIST, "Rent", "Set Rentable\nSet Rent Price", "Select", "Cancel");
- }
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You don't own a house.");
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/confirm", true))
- { // Confirming entrance/vehicle.
- if(SettingUpEntrance[playerid] == true)
- {
- new str[32], str2[32], str3[32];
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- SetupHouseInfo[playerid][SetupPX] = X;
- SetupHouseInfo[playerid][SetupPY] = Y;
- SetupHouseInfo[playerid][SetupPZ] = Z;
- HousePickup[playerid] = CreatePickup(1273, 23, X, Y, Z);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house entrance coordinates to:");
- format(str, sizeof(str), "X: %f", X);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- format(str2, sizeof(str2), "Y: %f", Y);
- SendClientMessage(playerid, 0xFFFFFFAA, str2);
- format(str3, sizeof(str3), "Z: %f", Z);
- SendClientMessage(playerid, 0xFFFFFFAA, str3);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- HasAlreadySetupEntrance[playerid] = true;
- return 1;
- }
- if(IsSettingUpVehicle[playerid] == true)
- {
- new Float:X, Float:Y, Float:Z, Float:A;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, A);
- SetupHouseInfo[playerid][SetupCarX] = X;
- SetupHouseInfo[playerid][SetupCarY] = Y;
- SetupHouseInfo[playerid][SetupCarZ] = Z;
- SetupHouseInfo[playerid][SetupCarRot] = A;
- HouseCar[playerid] = CreateVehicle(SetupHouseInfo[playerid][SetupCarModel], X, Y, Z, A, -1, -1, 5000000);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- HasAlreadySetupCar[playerid] = true;
- IsSettingUpVehicle[playerid] = false;
- return 1;
- }
- if(IsUpgradingVehicle[playerid] == true)
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new Float:X, Float:Y, Float:Z, Float:A;
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, A);
- HouseInfo[h][CarX] = X;
- HouseInfo[h][CarY] = Y;
- HouseInfo[h][CarZ] = Z;
- HouseInfo[h][CarRot] = A;
- HouseCar[playerid] = CreateVehicle(HouseInfo[h][CarModel], X, Y, Z, A, -1, -1, 5000000);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- IsUpgradingVehicle[playerid] = false;
- return 1;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/lockhouse", true))
- { // Locking house.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(HouseOwner[playerid] == true)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]))
- {
- if(HouseInfo[h][Locked] == 0)
- {
- HouseInfo[h][Locked] = 1;
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- GameTextForPlayer(playerid, "~r~House locked!", 5000, 6);
- return 1;
- }
- else if(HouseInfo[h][Locked] == 1)
- {
- HouseInfo[h][Locked] = 0;
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- GameTextForPlayer(playerid, "~g~House unlocked!", 5000, 6);
- return 1;
- }
- else if(!IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]))
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You are not near your house.");
- return 1;
- }
- }
- else if(HouseOwner[playerid] == false)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You don't own a house.");
- return 1;
- }
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/enter", true))
- { // Enter house.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]))
- {
- if(HouseInfo[h][Locked] == 0 || IsRentingHouse[playerid] == true)
- {
- SetPlayerPos(playerid, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]);
- SetPlayerFacingAngle(playerid, HouseInfo[h][TA]);
- SetPlayerInterior(playerid, HouseInfo[h][Int]);
- SetPlayerVirtualWorld(playerid, HouseInfo[h][Vir]);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE12F1FFF, "This house is locked.");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE12F1FFF, "You are not near a house.");
- return 1;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/exit", true))
- { // Exit house.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
- {
- SetPlayerPos(playerid, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]);
- SetPlayerFacingAngle(playerid, 0.0);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE12F1FFF, "You are not in a house.");
- return 1;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/sellhouse", true))
- { // Sell your house.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(HouseOwner[playerid] == true)
- {
- new str[64];
- format(str, sizeof(str), "Congratulations! You have sold your house for $%i.",HouseInfo[h][Price]/2);
- SendClientMessage(playerid, 0xFFFF00FF, str);
- GivePlayerMoney(playerid, HouseInfo[h][Price]/2);
- HouseOwner[playerid] = false;
- HouseInfo[h][Name] = 0;
- HouseInfo[h][Desc] = 0;
- HouseInfo[h][Owner] = 0;
- HouseInfo[h][Price] = 0;
- HouseInfo[h][PX] = 0.0;
- HouseInfo[h][PY] = 0.0;
- HouseInfo[h][PZ] = 0.0;
- HouseInfo[h][TX] = 0.0;
- HouseInfo[h][TY] = 0.0;
- HouseInfo[h][TZ] = 0.0;
- HouseInfo[h][TA] = 0.0;
- HouseInfo[h][Int] = 0;
- HouseInfo[h][Vir] = 0;
- DestroyVehicle(HouseCar[playerid]);
- DestroyPickup(HousePickup[playerid]);
- Delete3DTextLabel(HouseLabel[playerid]);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_Remove(file);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You don't own a house.");
- return 1;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/storecash", true))
- { // Store cash in house safe.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(HouseOwner[playerid] == true)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
- {
- ShowPlayerDialog(playerid, 674, DIALOG_STYLE_INPUT, "Cash", "Please enter an amount you would like to store in your cash box.", "Store", "Cancel");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE12F1FFF, "You are not in a house.");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE12F1FFF, "You don't own a house.");
- return 1;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/takecash", true))
- { // Take cash from house safe.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(HouseOwner[playerid] == true)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
- {
- ShowPlayerDialog(playerid, 675, DIALOG_STYLE_INPUT, "Cash", "Please enter an amount you would like to take from your cash box.", "Store", "Cancel");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE12F1FFF, "You are not in a house.");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE12F1FFF, "You don't own a house.");
- return 1;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/renthouse", true))
- { // Renting house.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(HouseOwner[playerid] == false)
- {
- if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][TX], HouseInfo[h][TY], HouseInfo[h][TZ]))
- {
- if(HouseInfo[h][Rentable] == 1)
- {
- if(IsRentingHouse[playerid] == false)
- {
- new string[64];
- format(string, sizeof(string), "Are you sure you would like to rent this house for $%i?", HouseInfo[h][RentPrice]);
- ShowPlayerDialog(playerid, 676, DIALOG_STYLE_MSGBOX, "Confirm Rent", string, "Yes", "No");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already rent a house!");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "This house is not available for rent.");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You are not near a house.");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You cannot rent a house if you own a house!");
- return 1;
- }
- }
- return 1;
- }
- if(!strcmp(cmdtext, "/unrenthouse", true))
- { // Unrenting house.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(IsRentingHouse[playerid] == true)
- {
- SendClientMessage(playerid, 0xFFFF00FF, "You have unrented the house, you are now homeless.");
- IsRentingHouse[playerid] = false;
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You are not renting any house!");
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(cmd, "/park", true) == 0)
- { // Park house car.
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(HouseOwner[playerid] == true)
- {
- if(IsPlayerInVehicle(playerid, HouseCar[playerid]))
- {
- new Float:X, Float:Y, Float:Z, Float:A;
- GetVehiclePos(HouseCar[playerid], X, Y, Z);
- GetVehicleZAngle(HouseCar[playerid], A);
- HouseInfo[h][CarX] = X;
- HouseInfo[h][CarY] = Y;
- HouseInfo[h][CarZ] = Z;
- HouseInfo[h][CarRot] = A;
- DestroyVehicle(HouseCar[playerid]);
- HouseCar[playerid] = CreateVehicle(HouseInfo[h][CarModel], HouseInfo[h][CarX], HouseInfo[h][CarY], HouseInfo[h][CarZ], HouseInfo[h][CarRot], -1, -1, 5000000);
- SendClientMessage(playerid, 0x33CCFFAA, "House car parked successfully.");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You are not in your vehicle!");
- return 1;
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You don't own a house.");
- return 1;
- }
- }
- return 1;
- }
- if(strcmp(cmd, "/approvehouse", true) == 0)
- { // Accepting house.
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Unknown command.");
- new tmp[128], giveplayerid;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- SendClientMessage(playerid, 0xE21F1FFF, "USAGE: /approvehouse [playerid/PartOfName]");
- return 1;
- }
- giveplayerid = ReturnUser(tmp);
- if(IsPlayerConnected(giveplayerid)) {
- if(giveplayerid != INVALID_PLAYER_ID) {
- if(IsApprovalPending[giveplayerid] == true) {
- new money = GetPlayerMoney(giveplayerid);
- if(money < SetupHouseInfo[giveplayerid][SetupPrice])
- { // Cannot afford, so we'll reset all variables used.
- SendClientMessage(giveplayerid, 0xE21F1FFF, "You cannot afford the house.");
- IsSettingUpHouse[giveplayerid] = false; SettingUpEntrance[giveplayerid] = false;
- HasAlreadySetupName[giveplayerid] = false; HasAlreadySetupDesc[giveplayerid] = false;
- HasAlreadySetupEntrance[giveplayerid] = false; HasAlreadySetupInterior[giveplayerid] = false;
- HasAlreadySetupRentable[giveplayerid] = false; HasAlreadySetupRentPrice[giveplayerid] = false;
- HasAlreadySetupCar[giveplayerid] = false;
- SetupHouseInfo[giveplayerid][SetupName] = 0; SetupHouseInfo[giveplayerid][SetupDesc] = 0;
- SetupHouseInfo[giveplayerid][SetupOwner] = 0; SetupHouseInfo[giveplayerid][SetupPrice] = 0;
- SetupHouseInfo[giveplayerid][SetupPX] = 0.0; SetupHouseInfo[giveplayerid][SetupPY] = 0.0;
- SetupHouseInfo[giveplayerid][SetupPZ] = 0.0; SetupHouseInfo[giveplayerid][SetupTX] = 0.0;
- SetupHouseInfo[giveplayerid][SetupTY] = 0.0; SetupHouseInfo[giveplayerid][SetupTZ] = 0.0;
- SetupHouseInfo[giveplayerid][SetupTA] = 0.0; SetupHouseInfo[giveplayerid][SetupInt] = 0;
- SetupHouseInfo[giveplayerid][SetupVir] = 0; SetupHouseInfo[giveplayerid][SetupRentable] = 0;
- SetupHouseInfo[giveplayerid][SetupRentPrice] = 0; SetupHouseInfo[giveplayerid][SetupCarX] = 0.0;
- SetupHouseInfo[giveplayerid][SetupCarY] = 0.0; SetupHouseInfo[giveplayerid][SetupCarZ] = 0.0;
- SetupHouseInfo[giveplayerid][SetupCarRot] = 0.0; SetupHouseInfo[giveplayerid][SetupCarModel] = 0;
- DestroyPickup(HousePickup[playerid]);
- Delete3DTextLabel(HouseLabel[playerid]);
- DestroyVehicle(HouseCar[playerid]);
- IsApprovalPending[giveplayerid] = false;
- PlayerPlaySound(giveplayerid, 1085, 0.0, 0.0, 0.0);
- new file[100], pname[24];
- GetPlayerName(giveplayerid, pname, 24);
- format(file, sizeof(file), "Houses/%s.ini", pname);
- dini_Remove(file);
- return 1;
- }
- else { // If player can afford house.
- new str[64];
- for(new h = 0; h < sizeof(HouseInfo); h++)
- { // Store setup data in house variables.
- new str2[128];
- HouseInfo[h][Name] = SetupHouseInfo[giveplayerid][SetupName];
- HouseInfo[h][Desc] = SetupHouseInfo[giveplayerid][SetupDesc];
- HouseInfo[h][Owner] = SetupHouseInfo[giveplayerid][SetupOwner];
- HouseInfo[h][Price] = SetupHouseInfo[giveplayerid][SetupPrice];
- HouseInfo[h][PX] = SetupHouseInfo[giveplayerid][SetupPX];
- HouseInfo[h][PY] = SetupHouseInfo[giveplayerid][SetupPY];
- HouseInfo[h][PZ] = SetupHouseInfo[giveplayerid][SetupPZ];
- HouseInfo[h][TX] = SetupHouseInfo[giveplayerid][SetupTX];
- HouseInfo[h][TY] = SetupHouseInfo[giveplayerid][SetupTY];
- HouseInfo[h][TZ] = SetupHouseInfo[giveplayerid][SetupTZ];
- HouseInfo[h][TA] = SetupHouseInfo[giveplayerid][SetupTA];
- HouseInfo[h][Int] = SetupHouseInfo[giveplayerid][SetupInt];
- HouseInfo[h][Vir] = SetupHouseInfo[giveplayerid][SetupVir];
- HouseInfo[h][Locked] = 0;
- HouseInfo[h][Rentable] = SetupHouseInfo[giveplayerid][SetupRentable];
- HouseInfo[h][RentPrice] = SetupHouseInfo[giveplayerid][SetupRentPrice];
- HouseInfo[h][CarModel] = SetupHouseInfo[giveplayerid][SetupCarModel];
- HouseInfo[h][CarX] = SetupHouseInfo[giveplayerid][SetupCarX];
- HouseInfo[h][CarY] = SetupHouseInfo[giveplayerid][SetupCarY];
- HouseInfo[h][CarZ] = SetupHouseInfo[giveplayerid][SetupCarZ];
- HouseInfo[h][CarRot] = SetupHouseInfo[giveplayerid][SetupCarRot];
- PlayerPlaySound(giveplayerid, 1149, 0.0, 0.0, 0.0);
- format(str, sizeof(str), "Congratulations! You have bought a house for $%i.", SetupHouseInfo[giveplayerid][SetupPrice]);
- SendClientMessage(giveplayerid, 0xFFFF00FF, str);
- GivePlayerMoney(giveplayerid, -HouseInfo[h][Price]);
- HouseOwner[giveplayerid] = true;
- IsSettingUpHouse[giveplayerid] = false; SettingUpEntrance[giveplayerid] = false;
- HasAlreadySetupName[giveplayerid] = false; HasAlreadySetupDesc[giveplayerid] = false;
- HasAlreadySetupEntrance[giveplayerid] = false; HasAlreadySetupInterior[giveplayerid] = false;
- SetupHouseInfo[giveplayerid][SetupName] = 0; SetupHouseInfo[giveplayerid][SetupDesc] = 0;
- SetupHouseInfo[giveplayerid][SetupOwner] = 0; SetupHouseInfo[giveplayerid][SetupPrice] = 0;
- SetupHouseInfo[giveplayerid][SetupPX] = 0.0; SetupHouseInfo[giveplayerid][SetupPY] = 0.0;
- SetupHouseInfo[giveplayerid][SetupPZ] = 0.0; SetupHouseInfo[giveplayerid][SetupTX] = 0.0;
- SetupHouseInfo[giveplayerid][SetupTY] = 0.0; SetupHouseInfo[giveplayerid][SetupTZ] = 0.0;
- SetupHouseInfo[giveplayerid][SetupTA] = 0.0; SetupHouseInfo[giveplayerid][SetupInt] = 0;
- SetupHouseInfo[giveplayerid][SetupVir] = 0; HasAlreadySetupRentable[giveplayerid] = false;
- SetupHouseInfo[giveplayerid][SetupRentable] = 0; HasAlreadySetupCar[giveplayerid] = false;
- SetupHouseInfo[giveplayerid][SetupRentable] = 0;
- SetupHouseInfo[giveplayerid][SetupRentPrice] = 0; SetupHouseInfo[giveplayerid][SetupCarX] = 0.0;
- SetupHouseInfo[giveplayerid][SetupCarY] = 0.0; SetupHouseInfo[giveplayerid][SetupCarZ] = 0.0;
- SetupHouseInfo[giveplayerid][SetupCarRot] = 0.0; SetupHouseInfo[giveplayerid][SetupCarModel] = 0;
- HasAlreadySetupRentPrice[giveplayerid] = false;
- IsApprovalPending[giveplayerid] = false;
- new pname[MAX_PLAYER_NAME];
- new name[256], desc[256];
- new file[100];
- GetPlayerName(giveplayerid, pname, sizeof(pname));
- format(file, sizeof(file), "Houses/%s.ini", pname);
- name = dini_Get(file, "Name");
- desc = dini_Get(file, "Description");
- format(str2, sizeof(str2), "Name: %s\n\nDescription: %s\n\nOwner: %s", name, desc, pname);
- HouseLabel[giveplayerid] = Create3DTextLabel(str2, 0xF97804FF, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ], 20.0, 0);
- for(new i; i<MAX_PLAYERS; i++)
- {
- SetPlayerMapIcon(i, HouseUser[playerid], HouseInfo[h][CarX], HouseInfo[h][CarY], HouseInfo[h][CarZ], 31, MAPICON_GLOBAL);
- }
- return 1;
- }
- }
- }
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "That player didn't create a house yet!");
- }
- return 1;
- }
- if(strcmp(cmd, "/denyhouse", true) == 0)
- { // Deny house.
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Unknown command.");
- new tmp[128], giveplayerid;
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- SendClientMessage(playerid, 0xE21F1FFF, "USAGE: /denyhouse [playerid/PartOfName]");
- return 1;
- }
- giveplayerid = ReturnUser(tmp);
- if(IsPlayerConnected(giveplayerid)) {
- if(giveplayerid != INVALID_PLAYER_ID) {
- if(IsApprovalPending[giveplayerid] == true) {
- SendClientMessage(giveplayerid, 0xE21F1FFF, "Your house request was denied.");
- IsSettingUpHouse[giveplayerid] = false; SettingUpEntrance[giveplayerid] = false;
- HasAlreadySetupName[giveplayerid] = false; HasAlreadySetupDesc[giveplayerid] = false;
- HasAlreadySetupEntrance[giveplayerid] = false; HasAlreadySetupInterior[giveplayerid] = false;
- SetupHouseInfo[giveplayerid][SetupName] = 0; SetupHouseInfo[giveplayerid][SetupDesc] = 0;
- SetupHouseInfo[giveplayerid][SetupOwner] = 0; SetupHouseInfo[giveplayerid][SetupPrice] = 0;
- SetupHouseInfo[giveplayerid][SetupPX] = 0.0; SetupHouseInfo[giveplayerid][SetupPY] = 0.0;
- SetupHouseInfo[giveplayerid][SetupPZ] = 0.0; SetupHouseInfo[giveplayerid][SetupTX] = 0.0;
- SetupHouseInfo[giveplayerid][SetupTY] = 0.0; SetupHouseInfo[giveplayerid][SetupTZ] = 0.0;
- SetupHouseInfo[giveplayerid][SetupTA] = 0.0; SetupHouseInfo[giveplayerid][SetupInt] = 0;
- SetupHouseInfo[giveplayerid][SetupVir] = 0; SetupHouseInfo[giveplayerid][SetupRentable] = 0;
- SetupHouseInfo[giveplayerid][SetupRentPrice] = 0;
- IsApprovalPending[giveplayerid] = false;
- DestroyPickup(HousePickup[giveplayerid]);
- Delete3DTextLabel(HouseLabel[giveplayerid]);
- PlayerPlaySound(giveplayerid, 1085, 0.0, 0.0, 0.0);
- new file[100], pname[24];
- GetPlayerName(giveplayerid, pname, 24);
- format(file, sizeof(file), "Houses/%s.ini", pname);
- dini_Remove(file);
- return 1;
- }
- }
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "That player didn't create a house yet!");
- }
- return 1;
- }
- return 0;
- }
- IsNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- ReturnUser(text[], playerid = INVALID_PLAYER_ID)
- {
- new pos = 0;
- while (text[pos] < 0x21) // Strip out leading spaces
- {
- if (text[pos] == 0) return INVALID_PLAYER_ID; // No passed text
- pos++;
- }
- new userid = INVALID_PLAYER_ID;
- if (IsNumeric(text[pos])) // Check whole passed string
- {
- // If they have a numeric name you have a problem (although names are checked on id failure)
- userid = strval(text[pos]);
- if (userid >=0 && userid < MAX_PLAYERS)
- {
- if(!IsPlayerConnected(userid))
- {
- /*if (playerid != INVALID_PLAYER_ID)
- {
- SendClientMessage(playerid, 0xFF0000AA, "User not connected");
- }*/
- userid = INVALID_PLAYER_ID;
- }
- else
- {
- return userid; // A player was found
- }
- }
- /*else
- {
- if (playerid != INVALID_PLAYER_ID)
- {
- SendClientMessage(playerid, 0xFF0000AA, "Invalid user ID");
- }
- userid = INVALID_PLAYER_ID;
- }
- return userid;*/
- // Removed for fallthrough code
- }
- // They entered [part of] a name or the id search failed (check names just incase)
- new len = strlen(text[pos]);
- new count = 0;
- new name[MAX_PLAYER_NAME];
- for (new i = 0; i < MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- GetPlayerName(i, name, sizeof (name));
- if (strcmp(name, text[pos], true, len) == 0) // Check segment of name
- {
- if (len == strlen(name)) // Exact match
- {
- return i; // Return the exact player on an exact match
- // Otherwise if there are two players:
- // Me and MeYou any time you entered Me it would find both
- // And never be able to return just Me's id
- }
- else // Partial match
- {
- count++;
- userid = i;
- }
- }
- }
- }
- if (count != 1)
- {
- if (playerid != INVALID_PLAYER_ID)
- {
- if (count)
- {
- SendClientMessage(playerid, 0xFF0000AA, "Multiple users found, please narrow earch");
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "No matching user found");
- }
- }
- userid = INVALID_PLAYER_ID;
- }
- return userid; // INVALID_USER_ID for bad return
- }
- // Called when a player uses the dialogs.
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 668) // House setup.
- {
- if(response)
- {
- if(listitem == 0) // Entrance
- {
- if(HasAlreadySetupEntrance[playerid] == false)
- {
- ShowPlayerDialog(playerid, 669, DIALOG_STYLE_MSGBOX, "Confirm Entrance", "Are you sure you want to mark your current position as the entrance to your house?", "Yes", "No");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already setup your entrance!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(listitem == 1) // Name
- {
- if(HasAlreadySetupName[playerid] == false)
- {
- ShowPlayerDialog(playerid, 670, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already setup your name!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(listitem == 2) // Description
- {
- if(HasAlreadySetupDesc[playerid] == false)
- {
- ShowPlayerDialog(playerid, 671, DIALOG_STYLE_INPUT, "Confirm Description", "Please type in the description of your house.\nExample: My house is the best house ever.", "Confirm", "Cancel");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already setup your description!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(listitem == 3) // Interior
- {
- if(HasAlreadySetupInterior[playerid] == false)
- {
- ShowPlayerDialog(playerid, 672, DIALOG_STYLE_LIST, "Confirm Interior", "Trailer ($7500)\nRyder's Crib ($9000)\nCJ's Crib ($10000)\nSweet's Crib ($12500)\nFancy Crib ($20000)\nWillowfield Safehouse ($25000)\nMansion ($500,000)\nMadd Dogg's Mansion ($1,000,000)\nCrack Palace ($2,500,000)", "Buy", "Cancel");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already setup your interior!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(listitem == 4) // Vehicle
- {
- if(HasAlreadySetupCar[playerid] == false)
- {
- ShowPlayerDialog(playerid, 687, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already setup your vehicle!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(listitem == 5) // Rent
- {
- if(HasAlreadySetupRentable[playerid] == false || HasAlreadySetupRentPrice[playerid] == false)
- {
- ShowPlayerDialog(playerid, 677, DIALOG_STYLE_LIST, "Rent", "Set Rentable\nSet Rent Price", "Select", "Cancel");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You already setup your rent info!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(listitem == 6) // Purchase
- {
- if(HasAlreadySetupEntrance[playerid] == false)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You didn't setup your entrance yet!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- if(HasAlreadySetupName[playerid] == false)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You didn't setup your name yet!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- if(HasAlreadySetupDesc[playerid] == false)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You didn't setup your description yet!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- if(HasAlreadySetupInterior[playerid] == false)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You didn't setup your interior yet!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- if(HasAlreadySetupCar[playerid] == false)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You didn't setup your vehicle yet!");
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- ShowPlayerDialog(playerid, 679, DIALOG_STYLE_MSGBOX, "Approval Pending", "You have created a house, but you must wait approval by an Administrator.", "Okay", "Cancel");
- IsApprovalPending[playerid] = true;
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(IsPlayerAdmin(i))
- {
- new str[128], pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pname, 24);
- format(str, sizeof(str), "HOUSE APPROVAL: %s has created a house, check the entrance. (/approvehouse to approve the house)", pname);
- SendClientMessage(i, 0x33AA33AA, str);
- return 1;
- }
- }
- }
- }
- else if(!response)
- {
- ShowPlayerDialog(playerid, 673, DIALOG_STYLE_MSGBOX, "Cancel", "Are you sure you want to stop creating your house?", "Yes", "No");
- return 1;
- }
- }
- if(dialogid == 669) // Entrance
- {
- if(response)
- {
- new str[32], str2[32], str3[32];
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- SetupHouseInfo[playerid][SetupPX] = X;
- SetupHouseInfo[playerid][SetupPY] = Y;
- SetupHouseInfo[playerid][SetupPZ] = Z;
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house entrance coordinates to:");
- format(str, sizeof(str), "X: %f", X);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- format(str2, sizeof(str2), "Y: %f", Y);
- SendClientMessage(playerid, 0xFFFFFFAA, str2);
- format(str3, sizeof(str3), "Z: %f", Z);
- SendClientMessage(playerid, 0xFFFFFFAA, str3);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- HasAlreadySetupEntrance[playerid] = true;
- HousePickup[playerid] = CreatePickup(1273, 23, X, Y, Z);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_FloatSet(file, "Pickup X", X);
- dini_FloatSet(file, "Pickup Y", Y);
- dini_FloatSet(file, "Pickup Z", Z);
- return 1;
- }
- else
- {
- SettingUpEntrance[playerid] = true;
- SendClientMessage(playerid, 0xFFFF00FF, "Stand in the position you want your house entrance at.");
- SendClientMessage(playerid, 0xFFFFFFAA, "HINT: When done, type /confirm.");
- return 1;
- }
- }
- if(dialogid == 670) // Name
- {
- if(response)
- {
- new str[64];
- if(strlen(inputtext) < 1) return ShowPlayerDialog(playerid, 670, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- if(strlen(inputtext) > 24) return ShowPlayerDialog(playerid, 670, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- SetupHouseInfo[playerid][SetupName] = strlen(inputtext);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house name to:");
- format(str, sizeof(str), "%s", inputtext);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupName[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_Set(file, "Name", inputtext);
- return 1;
- }
- else
- {
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(dialogid == 671) // Description
- {
- if(response)
- {
- new str[64];
- if(strlen(inputtext) < 1) return ShowPlayerDialog(playerid, 671, DIALOG_STYLE_INPUT, "Confirm Description", "Please type in the description of your house.\nExample: My house is the best house ever.", "Confirm", "Cancel");
- if(strlen(inputtext) > 32) return ShowPlayerDialog(playerid, 671, DIALOG_STYLE_INPUT, "Confirm Description", "Please type in the description of your house.\nExample: My house is the best house ever.", "Confirm", "Cancel");
- SetupHouseInfo[playerid][SetupDesc] = strlen(inputtext);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house description to:");
- format(str, sizeof(str), "%s", inputtext);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupDesc[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_Set(file, "Description", inputtext);
- return 1;
- }
- else
- {
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(dialogid == 672) // Interior
- {
- if(response)
- {
- if(!response) { ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel"); return 1; }
- if(listitem == 0)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 7500;
- SetupHouseInfo[playerid][SetupTX] = 2.0446;
- SetupHouseInfo[playerid][SetupTY] = -3.0297;
- SetupHouseInfo[playerid][SetupTZ] = 999.4284;
- SetupHouseInfo[playerid][SetupTA] = 79.7323;
- SetupHouseInfo[playerid][SetupInt] = 2;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Trailer");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 2);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 1)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 9000;
- SetupHouseInfo[playerid][SetupTX] = 2468.8330;
- SetupHouseInfo[playerid][SetupTY] = -1698.4697;
- SetupHouseInfo[playerid][SetupTZ] = 1013.5078;
- SetupHouseInfo[playerid][SetupTA] = 86.9390;
- SetupHouseInfo[playerid][SetupInt] = 2;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Ryder's Crib");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 2);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 2)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 10000;
- SetupHouseInfo[playerid][SetupTX] = 2496.0781;
- SetupHouseInfo[playerid][SetupTY] = -1692.0963;
- SetupHouseInfo[playerid][SetupTZ] = 1014.7422;
- SetupHouseInfo[playerid][SetupTA] = 180.4621;
- SetupHouseInfo[playerid][SetupInt] = 3;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "CJ's Crib");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 3);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 3)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 12500;
- SetupHouseInfo[playerid][SetupTX] = 2525.5933;
- SetupHouseInfo[playerid][SetupTY] = -1679.6655;
- SetupHouseInfo[playerid][SetupTZ] = 1015.4986;
- SetupHouseInfo[playerid][SetupTA] = 269.8060;
- SetupHouseInfo[playerid][SetupInt] = 1;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Sweet's Crib");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 1);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 4)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 20000;
- SetupHouseInfo[playerid][SetupTX] = 2216.5400;
- SetupHouseInfo[playerid][SetupTY] = -1076.2900;
- SetupHouseInfo[playerid][SetupTZ] = 1050.4844;
- SetupHouseInfo[playerid][SetupTA] = 90.0000;
- SetupHouseInfo[playerid][SetupInt] = 1;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Fancy Crib");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 1);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 5)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 25000;
- SetupHouseInfo[playerid][SetupTX] = 2282.9099;
- SetupHouseInfo[playerid][SetupTY] = -1138.2900;
- SetupHouseInfo[playerid][SetupTZ] = 1050.8984;
- SetupHouseInfo[playerid][SetupTA] = 360.0000;
- SetupHouseInfo[playerid][SetupInt] = 11;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Willowfield Safehouse");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 11);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 6)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 500000;
- SetupHouseInfo[playerid][SetupTX] = 2317.8201;
- SetupHouseInfo[playerid][SetupTY] = -1024.3892;
- SetupHouseInfo[playerid][SetupTZ] = 1050.2109;
- SetupHouseInfo[playerid][SetupTA] = 360.0000;
- SetupHouseInfo[playerid][SetupInt] = 9;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Mansion");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 9);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 7)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 1000000;
- SetupHouseInfo[playerid][SetupTX] = 1262.4561;
- SetupHouseInfo[playerid][SetupTY] = -785.2851;
- SetupHouseInfo[playerid][SetupTZ] = 1091.9063;
- SetupHouseInfo[playerid][SetupTA] = 270.6267;
- SetupHouseInfo[playerid][SetupInt] = 5;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Madd Dogg's Mansion");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 5);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 8)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- SetupHouseInfo[playerid][SetupPrice] += 2500000;
- SetupHouseInfo[playerid][SetupTX] = 2543.2571;
- SetupHouseInfo[playerid][SetupTY] = -1304.2988;
- SetupHouseInfo[playerid][SetupTZ] = 1025.0743;
- SetupHouseInfo[playerid][SetupTA] = 177.0683;
- SetupHouseInfo[playerid][SetupInt] = 2;
- SetupHouseInfo[playerid][SetupVir] = randvir;
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Crack Palace");
- format(str, sizeof(str), "Price: $%d", SetupHouseInfo[playerid][SetupPrice]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupInterior[playerid] = true;
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", SetupHouseInfo[playerid][SetupPrice]);
- dini_FloatSet(file, "Teleport X", SetupHouseInfo[playerid][SetupTX]);
- dini_FloatSet(file, "Teleport Y", SetupHouseInfo[playerid][SetupTY]);
- dini_FloatSet(file, "Teleport Z", SetupHouseInfo[playerid][SetupTZ]);
- dini_FloatSet(file, "Teleport Angle", SetupHouseInfo[playerid][SetupTA]);
- dini_IntSet(file, "Interior", 2);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- }
- else
- {
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(dialogid == 673) // House cancellation
- {
- if(response)
- {
- IsSettingUpHouse[playerid] = false; SettingUpEntrance[playerid] = false;
- HasAlreadySetupName[playerid] = false; HasAlreadySetupDesc[playerid] = false;
- HasAlreadySetupEntrance[playerid] = false; HasAlreadySetupInterior[playerid] = false;
- SetupHouseInfo[playerid][SetupName] = 0; SetupHouseInfo[playerid][SetupDesc] = 0;
- SetupHouseInfo[playerid][SetupOwner] = 0; SetupHouseInfo[playerid][SetupPrice] = 0;
- SetupHouseInfo[playerid][SetupPX] = 0.0; SetupHouseInfo[playerid][SetupPY] = 0.0;
- SetupHouseInfo[playerid][SetupPZ] = 0.0; SetupHouseInfo[playerid][SetupTX] = 0.0;
- SetupHouseInfo[playerid][SetupTY] = 0.0; SetupHouseInfo[playerid][SetupTZ] = 0.0;
- SetupHouseInfo[playerid][SetupTA] = 0.0; SetupHouseInfo[playerid][SetupInt] = 0;
- SetupHouseInfo[playerid][SetupVir] = 0; SetupHouseInfo[playerid][SetupCarX] = 0.0;
- SetupHouseInfo[playerid][SetupCarY] = 0.0; SetupHouseInfo[playerid][SetupCarZ] = 0.0;
- SetupHouseInfo[playerid][SetupCarRot] = 0.0;
- DestroyPickup(HousePickup[playerid]);
- Delete3DTextLabel(HouseLabel[playerid]);
- DestroyVehicle(HouseCar[playerid]);
- PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0xFFFFFFAA, "You have cancelled creating your house.");
- new file[100], pname[24];
- GetPlayerName(playerid, pname, 24);
- format(file, sizeof(file), "Houses/%s.ini", pname);
- dini_Remove(file);
- return 1;
- }
- else
- {
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(dialogid == 674) // Store cash
- {
- if(response)
- {
- new str[64];
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new money = strval(inputtext);
- new cash = GetPlayerMoney(playerid);
- if(cash < money)
- return SendClientMessage(playerid, 0xE21F1FFF, "You don't have that much!");
- if(money < 1 || money < 0 || money < -1)
- return SendClientMessage(playerid, 0xE21F1FFF, "You must input an amount above 0.");
- HouseInfo[h][Cash] += money;
- GivePlayerMoney(playerid, -money);
- format(str, sizeof(str), "You have stored $%i into your safe.",money);
- SendClientMessage(playerid, 0xFFFF00FF, str);
- return 1;
- }
- }
- }
- if(dialogid == 675) // Take cash
- {
- if(response)
- {
- new str[64];
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new money = strval(inputtext);
- if(HouseInfo[h][Cash] < money)
- return SendClientMessage(playerid, 0xE21F1FFF, "You don't have that much in your safe!");
- if(money < 1 || money < 0 || money < -1)
- return SendClientMessage(playerid, 0xE21F1FFF, "You must input an amount above 0.");
- HouseInfo[h][Cash] -= money;
- GivePlayerMoney(playerid, money);
- format(str, sizeof(str), "You have taken $%i from your safe.",money);
- SendClientMessage(playerid, 0xFFFF00FF, str);
- return 1;
- }
- }
- }
- if(dialogid == 676) // Renting house
- {
- if(response)
- {
- new str[64], money = GetPlayerMoney(playerid);
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(money < HouseInfo[h][RentPrice])
- {
- SendClientMessage(playerid, 0xE21F1FFF, "You cannot afford the house.");
- PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
- return 1;
- }
- else
- {
- GivePlayerMoney(playerid, -HouseInfo[h][RentPrice]);
- format(str, sizeof(str), "You have successfully rented this house for $%i!", HouseInfo[h][RentPrice]);
- SendClientMessage(playerid, 0xFFFF00FF, str);
- IsRentingHouse[playerid] = true;
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HouseInfo[h][Cash] += HouseInfo[h][RentPrice];
- return 1;
- }
- }
- }
- }
- if(dialogid == 677) // Rent
- {
- if(response)
- {
- if(!response)
- return ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- if(listitem == 0)
- {
- if(SetupHouseInfo[playerid][SetupRentable] == 0)
- {
- SetupHouseInfo[playerid][SetupRentable] = 1;
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0xFFFF00FF, "Rent enabled.");
- ShowPlayerDialog(playerid, 677, DIALOG_STYLE_LIST, "Rent", "Set Rentable\nSet Rent Price", "Select", "Cancel");
- return 1;
- }
- else
- {
- SetupHouseInfo[playerid][SetupRentable] = 0;
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0xFFFF00FF, "Rent disabled.");
- ShowPlayerDialog(playerid, 677, DIALOG_STYLE_LIST, "Rent", "Set Rentable\nSet Rent Price", "Select", "Cancel");
- return 1;
- }
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid, 678, DIALOG_STYLE_INPUT, "Rent Price", "Please enter the price you want to set as your rent price.", "Finish", "Cancel");
- return 1;
- }
- if(!response)
- return ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- }
- }
- if(dialogid == 678) // Rent Price
- {
- if(response)
- {
- new amount = strval(inputtext);
- if(amount < 1)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "Amount must be above 1.");
- ShowPlayerDialog(playerid, 678, DIALOG_STYLE_INPUT, "Rent Price", "Please enter the price you want to set as your rent price.", "Finish", "Cancel");
- return 1;
- }
- if(amount > 5000)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "Amount must be below 5000.");
- ShowPlayerDialog(playerid, 678, DIALOG_STYLE_INPUT, "Rent Price", "Please enter the price you want to set as your rent price.", "Finish", "Cancel");
- return 1;
- }
- SetupHouseInfo[playerid][SetupRentPrice] = amount;
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- HasAlreadySetupRentable[playerid] = true;
- HasAlreadySetupRentPrice[playerid] = true;
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- else if(!response)
- {
- ShowPlayerDialog(playerid, 677, DIALOG_STYLE_LIST, "Rent", "Set Rentable\nSet Rent Price", "Select", "Cancel");
- return 1;
- }
- }
- if(dialogid == 681) // Upgrade Name
- {
- if(response)
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new str[64];
- if(strlen(inputtext) < 1) return ShowPlayerDialog(playerid, 670, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- if(strlen(inputtext) > 24) return ShowPlayerDialog(playerid, 670, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- HouseInfo[h][Name] = strlen(inputtext);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house name to:");
- format(str, sizeof(str), "%s", inputtext);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_Set(file, "Name", inputtext);
- new pname[MAX_PLAYER_NAME];
- new name[256], desc[256], strr[128];
- DestroyPickup(HousePickup[playerid]);
- Delete3DTextLabel(HouseLabel[playerid]);
- GetPlayerName(playerid, pname, sizeof(pname));
- name = dini_Get(file, "Name");
- desc = dini_Get(file, "Description");
- if(HouseInfo[h][Rentable] == 0)
- {
- format(strr, sizeof(strr), "Name: %s\n\nDescription: %s\n\nOwner: %s", name, desc, pname);
- }
- else
- {
- format(strr, sizeof(strr), "Name: %s\n\nDescription: %s\n\nOwner: %s\n\nRent Price: $%i", name, desc, pname, HouseInfo[h][RentPrice]);
- }
- HouseLabel[playerid] = Create3DTextLabel(strr, 0xF97804FF, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ], 20.0, 0);
- HousePickup[playerid] = CreatePickup(1273, 23, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]);
- return 1;
- }
- }
- }
- if(dialogid == 682) // Upgrade Desc
- {
- if(response)
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new str[64];
- if(strlen(inputtext) < 1) return ShowPlayerDialog(playerid, 670, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- if(strlen(inputtext) > 24) return ShowPlayerDialog(playerid, 670, DIALOG_STYLE_INPUT, "Confirm Name", "Please type in the name of your house.\nExample: Family house.", "Confirm", "Cancel");
- HouseInfo[h][Desc] = strlen(inputtext);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house description to:");
- format(str, sizeof(str), "%s", inputtext);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_Set(file, "Description", inputtext);
- new pname[MAX_PLAYER_NAME];
- new name[256], desc[256], strr[128];
- DestroyPickup(HousePickup[playerid]);
- Delete3DTextLabel(HouseLabel[playerid]);
- GetPlayerName(playerid, pname, sizeof(pname));
- name = dini_Get(file, "Name");
- desc = dini_Get(file, "Description");
- if(HouseInfo[h][Rentable] == 0)
- {
- format(strr, sizeof(strr), "Name: %s\n\nDescription: %s\n\nOwner: %s", name, desc, pname);
- }
- else
- {
- format(strr, sizeof(strr), "Name: %s\n\nDescription: %s\n\nOwner: %s\n\nRent Price: $%i", name, desc, pname, HouseInfo[h][RentPrice]);
- }
- HouseLabel[playerid] = Create3DTextLabel(strr, 0xF97804FF, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ], 20.0, 0);
- HousePickup[playerid] = CreatePickup(1273, 23, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]);
- return 1;
- }
- }
- }
- if(dialogid == 683) // Upgrade Entrance
- {
- if(response)
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new pname[MAX_PLAYER_NAME], Float:X, Float:Y, Float:Z;
- new name[256], desc[256], file[100], strr[128];
- DestroyPickup(HousePickup[playerid]);
- Delete3DTextLabel(HouseLabel[playerid]);
- GetPlayerName(playerid, pname, sizeof(pname));
- format(file, sizeof(file), "Houses/%s.ini", pname);
- name = dini_Get(file, "Name");
- desc = dini_Get(file, "Description");
- if(HouseInfo[h][Rentable] == 0)
- {
- format(strr, sizeof(strr), "Name: %s\n\nDescription: %s\n\nOwner: %s", name, desc, pname);
- }
- else
- {
- format(strr, sizeof(strr), "Name: %s\n\nDescription: %s\n\nOwner: %s\n\nRent Price: $%i", name, desc, pname, HouseInfo[h][RentPrice]);
- }
- new str[32], str2[32], str3[32];
- GetPlayerPos(playerid, X, Y, Z);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- dini_FloatSet(file, "Pickup X", X);
- dini_FloatSet(file, "Pickup Y", Y);
- dini_FloatSet(file, "Pickup Z", Z);
- HouseInfo[h][PX] = X;
- HouseInfo[h][PY] = Y;
- HouseInfo[h][PZ] = Z;
- HouseLabel[playerid] = Create3DTextLabel(strr, 0xF97804FF, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ], 20.0, 0);
- HousePickup[playerid] = CreatePickup(1273, 23, HouseInfo[h][PX], HouseInfo[h][PY], HouseInfo[h][PZ]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house entrance coordinates to:");
- format(str, sizeof(str), "X: %f", X);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- format(str2, sizeof(str2), "Y: %f", Y);
- SendClientMessage(playerid, 0xFFFFFFAA, str2);
- format(str3, sizeof(str3), "Z: %f", Z);
- SendClientMessage(playerid, 0xFFFFFFAA, str3);
- return 1;
- }
- }
- }
- if(dialogid == 684 && response) // Upgrade Interior
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(listitem == 0)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 7500;
- HouseInfo[h][TX] = 2.0446;
- HouseInfo[h][TY] = -3.0297;
- HouseInfo[h][TZ] = 999.4284;
- HouseInfo[h][TA] = 79.7323;
- HouseInfo[h][Int] = 2;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Trailer");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 2);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 1)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 9000;
- HouseInfo[h][TX] = 2468.8330;
- HouseInfo[h][TY] = -1698.4697;
- HouseInfo[h][TZ] = 1013.5078;
- HouseInfo[h][TA] = 86.9390;
- HouseInfo[h][Int] = 2;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Ryder's Crib");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 2);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 2)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 10000;
- HouseInfo[h][TX] = 2496.0781;
- HouseInfo[h][TY] = -1692.0963;
- HouseInfo[h][TZ] = 1014.7422;
- HouseInfo[h][TA] = 180.4621;
- HouseInfo[h][Int] = 3;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "CJ's Crib");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 3);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 3)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 12500;
- HouseInfo[h][TX] = 2525.5933;
- HouseInfo[h][TY] = -1679.6655;
- HouseInfo[h][TZ] = 1015.4986;
- HouseInfo[h][TA] = 269.8060;
- HouseInfo[h][Int] = 1;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Sweet's Crib");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 1);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 4)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 20000;
- HouseInfo[h][TX] = 2216.5400;
- HouseInfo[h][TY] = -1076.2900;
- HouseInfo[h][TZ] = 1050.4844;
- HouseInfo[h][TA] = 90.0000;
- HouseInfo[h][Int] = 1;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Fancy Crib");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 1);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 5)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 25000;
- HouseInfo[h][TX] = 2282.9099;
- HouseInfo[h][TY] = -1138.2900;
- HouseInfo[h][TZ] = 1050.8984;
- HouseInfo[h][TA] = 360.0000;
- HouseInfo[h][Int] = 11;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Willowfield Safehouse");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 11);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 6)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 500000;
- HouseInfo[h][TX] = 2317.8201;
- HouseInfo[h][TY] = -1024.3892;
- HouseInfo[h][TZ] = 1050.2109;
- HouseInfo[h][TA] = 360.0000;
- HouseInfo[h][Int] = 9;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Mansion");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 9);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 7)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 1000000;
- HouseInfo[h][TX] = 1262.4561;
- HouseInfo[h][TY] = -785.2851;
- HouseInfo[h][TZ] = 1091.9063;
- HouseInfo[h][TA] = 270.6267;
- HouseInfo[h][Int] = 5;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Madd Dogg's Mansion");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 5);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- if(listitem == 8)
- {
- new randvir = 2 + random(1999999);
- new str[64];
- HouseInfo[h][Price] = 2500000;
- HouseInfo[h][TX] = 2543.2571;
- HouseInfo[h][TY] = -1304.2988;
- HouseInfo[h][TZ] = 1025.0743;
- HouseInfo[h][TA] = 177.0683;
- HouseInfo[h][Int] = 2;
- HouseInfo[h][Vir] = randvir;
- new money = GetPlayerMoney(playerid);
- if(money >= HouseInfo[h][Price])
- return GivePlayerMoney(playerid, -HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFF00FF, "You have set your house interior to:");
- SendClientMessage(playerid, 0xFFFFFFAA, "Crack Palace");
- format(str, sizeof(str), "Price: $%d", HouseInfo[h][Price]);
- SendClientMessage(playerid, 0xFFFFFFAA, str);
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- new file[100], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, 24);
- format(file, sizeof(file), "Houses/%s.ini", pName);
- dini_IntSet(file, "Price", HouseInfo[h][Price]);
- dini_FloatSet(file, "Teleport X", HouseInfo[h][TX]);
- dini_FloatSet(file, "Teleport Y", HouseInfo[h][TY]);
- dini_FloatSet(file, "Teleport Z", HouseInfo[h][TZ]);
- dini_FloatSet(file, "Teleport Angle", HouseInfo[h][TA]);
- dini_IntSet(file, "Interior", 2);
- dini_IntSet(file, "Virtual", randvir);
- return 1;
- }
- }
- }
- if(dialogid == 685 && response) // Upgrade Rent
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(listitem == 0)
- {
- if(HouseInfo[h][Rentable] == 0)
- {
- HouseInfo[h][Rentable] = 1;
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0xFFFF00FF, "Rent enabled.");
- return 1;
- }
- else
- {
- HouseInfo[h][Rentable] = 0;
- PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, 0xFFFF00FF, "Rent disabled.");
- return 1;
- }
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid, 686, DIALOG_STYLE_INPUT, "Rent Price", "Please enter the price you want to set as your rent price.", "Finish", "Cancel");
- return 1;
- }
- }
- }
- if(dialogid == 686 && response) // Upgrade Rent Price
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- if(response)
- {
- new amount = strval(inputtext);
- if(amount < 1)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "Amount must be above 1.");
- ShowPlayerDialog(playerid, 678, DIALOG_STYLE_INPUT, "Rent Price", "Please enter the price you want to set as your rent price.", "Finish", "Cancel");
- return 1;
- }
- if(amount > 5000)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "Amount must be below 5000.");
- ShowPlayerDialog(playerid, 678, DIALOG_STYLE_INPUT, "Rent Price", "Please enter the price you want to set as your rent price.", "Finish", "Cancel");
- return 1;
- }
- HouseInfo[h][RentPrice] = amount;
- PlayerPlaySound(playerid, 1149, 0.0, 0.0, 0.0);
- return 1;
- }
- }
- }
- if(dialogid == 687) // Vehicle
- {
- if(response)
- {
- new model = strval(inputtext);
- if(model < 400)
- return ShowPlayerDialog(playerid, 687, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- if(model > 611)
- return ShowPlayerDialog(playerid, 687, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- if(model == 425 || model == 432 || model == 476 || model == 447 || model == 537 || model == 538 || model == 569 || model == 570 || model == 584 || model == 590 || model == 591 || model == 606 || model == 607 || model == 608 || model == 610 || model == 611 || model == 441 || model == 464 || model == 465 || model == 501 || model == 564 || model == 594 || model == 435 || model == 449 || model == 450)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "Those vehicles are restricted!");
- ShowPlayerDialog(playerid, 687, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- return 1;
- }
- SetupHouseInfo[playerid][SetupCarModel] = model;
- IsSettingUpVehicle[playerid] = true;
- ShowPlayerDialog(playerid, 255, DIALOG_STYLE_MSGBOX, "Vehicle Setup", "Go to the position you want your vehicle to spawn, then type /confirm.", "Select", "Cancel");
- return 1;
- }
- else
- {
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- if(dialogid == 688) // Upgrade Vehicle
- {
- if(response)
- {
- for(new h = 0; h < sizeof(HouseInfo); h++)
- {
- new model = strval(inputtext);
- if(model < 400)
- return ShowPlayerDialog(playerid, 687, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- if(model > 611)
- return ShowPlayerDialog(playerid, 687, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- if(model == 425 || model == 432 || model == 476 || model == 447 || model == 537 || model == 538 || model == 569 || model == 570 || model == 584 || model == 590 || model == 591 || model == 606 || model == 607 || model == 608 || model == 610 || model == 611 || model == 441 || model == 464 || model == 465 || model == 501 || model == 564 || model == 594 || model == 435 || model == 449 || model == 450)
- {
- SendClientMessage(playerid, 0xE21F1FFF, "Those vehicles are restricted!");
- ShowPlayerDialog(playerid, 687, DIALOG_STYLE_INPUT, "Vehicle", "Please enter a vehicle ID from 400 to 611.", "Create", "Cancel");
- return 1;
- }
- HouseInfo[h][CarModel] = model;
- IsUpgradingVehicle[playerid] = true;
- ShowPlayerDialog(playerid, 255, DIALOG_STYLE_MSGBOX, "Vehicle Setup", "Go to the position you want your vehicle to spawn, then type /confirm.", "Select", "Cancel");
- return 1;
- }
- }
- else
- {
- ShowPlayerDialog(playerid, 668, DIALOG_STYLE_LIST, "House Setup", "Entrance\nName\nDescription\nInterior\nVehicle\nRent\nPurchase", "Select", "Cancel");
- return 1;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement