Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <streamer>
- #include <sscanf2>
- #include <dini>
- #include <zcmd>
- //=========[Internal Functions/Other]========
- #define BUILDINGHOUSE(%0) GetPVarInt(%0, "BuildingHouse")
- #define BUILDID(%0) GetPVarInt(%0, "BuildID")
- #define HOUSEID(%0) GetPVarInt(%0, "HouseID")
- //===========================
- //=========[Internal Settings]========== [Don't not edit these unless you know what you are doing]
- // [House Settings/Options]
- #define HOUSE_DIAG 5050 //Change if dialogs are interfering with another script
- #define MAX_HOUSES 30 //Important! - Change to total number of houses
- #define MAX_HOUSE_NAME 40 //Max house name
- #define MIN_PASS 3 //Minimum password length
- #define MAX_PASS 30 //Max password length
- #define RESPAWNTIME 1400 //Time until player is set in his house
- #define MAX_VEHICLE_SLOTS 3 //Max house vehicle slots per-player
- // [Model IDs]
- #define NOTFORSALE_PICKUP 1272
- #define FORSALE_PICKUP 1273
- #define NOTFORSALE_ICON 32
- #define FORSALE_ICON 31
- // [Draw Distance]
- #define ICON_DRAW 150.0
- #define PICKUP_DRAW 30.0
- #define LABEL_DRAW 35.0
- #define ENTERCP_DRAW 15.0
- #define EXITCP_DRAW 15.0
- // [Size]
- #define ENTERCP_SIZE 1.0
- #define EXITCP_SIZE 1.0
- // [Properties]
- #define LABEL_LOS 1 //Labels show through objects? [1-Yes/0-No]
- //===========================
- #define LABEL_COLOR 0xFFFFFFF
- #define MSG_COLOR 0x37C83AFF
- #define G> 009900 //Green
- #define R> CC0000 //Red
- #define B> 0004B6 //Blue
- #define LB> 00EFFC //Light Blue
- #define Y> F8FF3D //Yellow
- #define W> FFFFFF //White
- #define HOUSE_FILE "/Houses/%d.ini"
- #define HUSER_FILE "/Houses/users.ini"
- new hfile[120];
- new hstr[800];
- enum h_enum
- {
- Name[MAX_HOUSE_NAME],
- Owner[MAX_PLAYER_NAME],
- Price,
- ForSale,
- Interior,
- World,
- Locked,
- Float:EnterPos[4],
- Float:ExitPos[4],
- Float:SpawnPos[4],
- Float:PickupPos[3],
- Float:LabelPos[3],
- Float:EnterCPPos[3],
- Float:ExitCPPos[3],
- Float:VehPos[4],
- MapIcon,
- Pickup,
- Text3D:InfoLabel,
- Text3D:NoticeLabel,
- EnterCP,
- ExitCP,
- MoneyStash
- }
- new hInfo[MAX_HOUSES][h_enum];
- enum h_veh
- {
- Vehicle,
- ModelID
- }
- new hVeh[MAX_HOUSES][MAX_VEHICLE_SLOTS][h_veh];
- new Float:IntPos[37][3] = {
- {2450.071777, -1688.474609, 1013.507812}, //Ryder's House
- {1278.083740, -774.104187, 1091.906250}, //Madd Dogg's
- {2575.200683, -1281.903808, 1067.282348}, //Big Smoke's
- {2495.094238, -1697.413940, 1015.265625}, //CJ's House
- {2233.024414, -1106.857543, 1050.882812}, //Safe House 1
- {2193.356933, -1204.220092, 1049.513427}, //Safe House 2
- {2319.962158, -1024.064453, 1050.210937}, //Safe House 3
- {2263.350585, -1137.814697, 1050.632812}, //Safe House 4
- {2365.204589, -1131.669189, 1050.875000}, //Verdant Bluff safehouse
- {2283.675537, -1136.566406, 1050.898437}, //Willowfield Safehouse
- {2207.153320, -1075.087036, 1050.484375}, //Camel Toe Safehouse
- {2324.155273, -1184.790527, 1027.976562}, //Burning Desire
- {2808.903564, -1170.313354, 1025.570312}, //Colonel
- {-2162.869384, 643.826354, 1057.586059}, //Woozies Apt
- {-2646.922119, 1407.898681, 906.273437}, //Pleasure Dome
- {246.360671, 304.616027, 999.148437}, //Denise's
- {322.806274, 305.147125, 999.148437}, //Barbaras
- {269.487518, 306.877838, 1000.020385}, //Katies
- {306.081146, 306.673492, 1003.304687}, //Michelle's
- {347.518463, 307.700012, 999.148437}, //Millies
- {233.677841, 1193.183105, 1080.257812}, //Burglary 1
- {222.140792, 1241.278808, 1082.140625}, //Burglary 2
- {224.929153, 1291.060302, 1082.140625}, //Burglary 3
- {244.907913, 1115.963134, 1080.992187}, //Burglary 4
- {295.068664, 1480.463623, 1080.257812}, //Burglary 5
- {266.206146, 1287.478759, 1080.257812}, //Burglary 6
- {30.468364, 1350.344482, 1084.375000}, //Burglary 7
- {-264.832733, 1456.319213, 1084.367187}, //Burglary 8
- {22.478155, 1417.368652, 1084.429687}, //Burglary 9
- {139.954757, 1378.600097, 1088.367187}, //Burglary 10
- {234.361801, 1067.058105, 1084.207397}, //Burglary 11
- {-68.999641, 1364.879638, 1080.210937}, //Burglary 12
- {-297.281158, 1478.645751, 1084.375000}, //Burglary 13
- {-50.664768, 1408.467163, 1084.429687}, //Burglary 14
- {93.521530, 1326.241699, 1083.859375}, //Burglary 15
- {261.748474, 1248.680786, 1084.257812}, //Burglary 16
- {447.626403, 1407.644531, 1084.304687} //Burglary 17
- };
- new IntID[37] = {2, 5, 2, 3, 5, 6, 9, 10, 8, 11, 1, 5, 8, 1, 3, 1, 5, 2, 4, 6, 3, 2, 1, 5, 15, 4, 10, 4, 5, 5, 6, 6, 15, 8, 9, 9, 2};
- static stock VehicleNames[212][] = {
- "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus",
- "Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto","Taxi","Washington","Bobcat","Mr Whoopee","BF Injection",
- "Hunter","Premier","Enforcer","Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie",
- "Stallion","Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","Turismo","Speeder",
- "Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider",
- "Glendale","Oceanic","Sanchez","Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina",
- "Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood",
- "Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa","RC Goblin","Hotring Racer A","Hotring Racer B",
- "Bloodring Banger","Rancher","Super GT","Elegant","Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain",
- "Nebula","Majestic","Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck",
- "Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak","Vortex","Vincent","Bullet","Clover",
- "Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A",
- "Monster B","Uranus","Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight","Trailer",
- "Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford","BF-400","Newsvan","Tug","Trailer A","Emperor",
- "Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)",
- "Police Car (LVPD)","Police Ranger","Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
- "Stair Trailer","Boxville","Farm Plow","Utility Trailer"
- };
- new Text:IntScrollTD;
- new inmenu[MAX_PLAYERS];
- forward SpawnPlayerAtHouse(playerid);
- public OnFilterScriptInit()
- {
- print("Dynamic House System v0.7 by '[ABK]PotH3Ad' [www.abkclan.com] started...");
- if(!fexist(HUSER_FILE)) dini_Create(HUSER_FILE);
- LoadIntScrollTextdraw();
- LoadHouses();
- return 1;
- }
- public OnFilterScriptExit()
- {
- print(" Dynamic House System v0.7 by '[ABK]PotH3Ad' [www.abkclan.com] unloaded...");
- for(new x=0; x<MAX_HOUSES; x++)
- {
- DestroyDynamicCP(hInfo[x][EnterCP]);
- DestroyDynamicCP(hInfo[x][ExitCP]);
- DestroyDynamicPickup(hInfo[x][Pickup]);
- DestroyDynamicMapIcon(hInfo[x][MapIcon]);
- DestroyDynamic3DTextLabel(hInfo[x][InfoLabel]);
- for(new z=0; z<MAX_VEHICLE_SLOTS; z++) DestroyVehicle(hVeh[x][z][Vehicle]);
- }
- TextDrawDestroy(IntScrollTD);
- return 1;
- }
- CMD:hexit(playerid, params[])
- {
- if(!BUILDINGHOUSE(playerid)) return SendClientMessage(playerid, MSG_COLOR, "ERROR: You are not building a house!");
- SetPVarInt(playerid, "BuildingHouse", 0);
- SendClientMessage(playerid, MSG_COLOR, "You are no longer in house build mode!");
- return 1;
- }
- CMD:intview(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, MSG_COLOR, "ERROR: You are not an admin!");
- SetPVarInt(playerid, "InIntView", 1);
- UpdateIntScrollTextdraw(playerid);
- return 1;
- }
- CMD:hmenu(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, MSG_COLOR, "ERROR: You are not an admin!");
- if(BUILDINGHOUSE(playerid)) return SendClientMessage(playerid, MSG_COLOR, "ERROR: You are already building a house!");
- ShowBuilderDialog(playerid);
- return 1;
- }
- CMD:hedit(playerid, params[])
- {
- if(!BUILDINGHOUSE(playerid)) return SendClientMessage(playerid, MSG_COLOR, "ERROR: You are not building a house!");
- ShowEditDialog(playerid);
- return 1;
- }
- CMD:hcmds(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, MSG_COLOR, "<House> You are not an admin to use the house builder!");
- SendClientMessage(playerid, MSG_COLOR, "<House> Commands: /hedit, /hmenu, /hexit, /intview");
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(IsPlayerToSpawnAtHouse(playerid))
- {
- SetTimerEx("SpawnPlayerAtHouse", RESPAWNTIME, 0, "d", playerid);
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(!response) if(dialogid >= 12 && dialogid <= 19) inmenu[playerid] = 0;
- if(dialogid == HOUSE_DIAG)
- {
- if(!response) return 1;
- if(listitem == 0)
- {
- new hid = GetLowestOpenSlot();
- SetPVarInt(playerid, "BuildingHouse", 1);
- format(hfile, sizeof(hfile), HOUSE_FILE, hid);
- dini_Create(hfile);
- dini_Set(hfile, "Builder", pName(playerid));
- dini_Set(hfile, "Owner", "No Owner");
- dini_Set(hfile, "Name", "Home");
- SetPVarInt(playerid, "BuildID", hid);
- SendClientMessage(playerid, MSG_COLOR, "You are now building a house! {0000FF}(Tip: Use '/hedit' to access the edit menu)");
- }
- else if(listitem == 1)
- {
- format(hstr, sizeof(hstr), "ID\tHouse Name\n");
- for(new x=0; x<MAX_HOUSES; x++)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, x);
- if(strlen(dini_Get(hfile, "Name")) > 0) format(hstr, sizeof(hstr), "%s%d\t%s\n", hstr, x, dini_Get(hfile, "Name"));
- else format(hstr, sizeof(hstr), "%s%d\tN/A\n", hstr, x);
- }
- ShowPlayerDialog(playerid, HOUSE_DIAG+1, DIALOG_STYLE_LIST, "Choose a house to edit", hstr, "Select", "Exit");
- }
- else if(listitem == 2)
- {
- format(hstr, sizeof(hstr), "ID\tHouse Name\n");
- for(new x=0; x<MAX_HOUSES; x++)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, x);
- if(strlen(dini_Get(hfile, "Name")) > 0) format(hstr, sizeof(hstr), "%s%d\t%s\n", hstr, x, dini_Get(hfile, "Name"));
- else format(hstr, sizeof(hstr), "%s%d\tN/A\n", hstr, x);
- }
- ShowPlayerDialog(playerid, HOUSE_DIAG+2, DIALOG_STYLE_LIST, "Delete a house", hstr, "Select", "Exit");
- }
- else if(listitem == 3)
- {
- format(hstr, sizeof(hstr), "ID\tHouse Name\n");
- for(new x=0; x<MAX_HOUSES; x++)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, x);
- if(strlen(dini_Get(hfile, "Name")) > 0) format(hstr, sizeof(hstr), "%s%d\t%s\n", hstr, x, dini_Get(hfile, "Name"));
- else format(hstr, sizeof(hstr), "%s%d\tN/A\n", hstr, x);
- }
- ShowPlayerDialog(playerid, HOUSE_DIAG+3, DIALOG_STYLE_LIST, "Select a house to view info", hstr, "Select", "Back");
- }
- }
- else if(dialogid == HOUSE_DIAG+1)
- {
- if(response)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, listitem-1);
- if(!dini_Exists(hfile)) return OnDialogResponse(playerid, HOUSE_DIAG, 1, 1, "blank");
- SetPVarInt(playerid, "BuildingHouse", 1);
- SetPVarInt(playerid, "BuildID", listitem-1);
- SendClientMessage(playerid, MSG_COLOR, "You are now editing a house! {0000FF}(Tip: Use '/hedit' to access the edit menu)");
- }
- else ShowBuilderDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+2)
- {
- if(response)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, listitem-1);
- if(!dini_Exists(hfile)) return OnDialogResponse(playerid, HOUSE_DIAG, 1, 2, "blank");
- DeleteHouse(listitem-1);
- }
- else ShowBuilderDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+3)
- {
- if(response)
- {
- #define hid listitem-1
- format(hfile, sizeof(hfile), HOUSE_FILE, hid);
- if(!dini_Exists(hfile)) return OnDialogResponse(playerid, HOUSE_DIAG, 1, 3, "blank");
- format(hstr, sizeof(hstr), "House Name\t\t%s (ID %d)\nOwner\t\t\t%s\nBuilder\t\t\t%s\nPrice\t\t\t$%d\nFor Sale\t\t%d\nInterior\t\t%d\nWorld\t\t\t%d", hInfo[hid][Name],
- hid, hInfo[hid][Owner], dini_Get(hfile, "Builder"), hInfo[hid][Price], hInfo[hid][ForSale], hInfo[hid][Interior], hInfo[hid][World]);
- ShowPlayerDialog(playerid, HOUSE_DIAG-1, DIALOG_STYLE_MSGBOX, "House Information", hstr, "Ok", "Exit");
- }
- else ShowBuilderDialog(playerid);
- }
- //Edit menu
- else if(dialogid == HOUSE_DIAG+4)
- {
- if(!response) return 1;
- if(listitem == 0)
- ShowPlayerDialog(playerid, HOUSE_DIAG+5, DIALOG_STYLE_INPUT, "{"#B>"}House Edit - {"#G>"}House Name", "Enter a house name under 40 characters long in the field below", "Continue", "Cancel");
- else if(listitem == 1)
- ShowPlayerDialog(playerid, HOUSE_DIAG+6, DIALOG_STYLE_INPUT, "{"#B>"}House Edit - {"#G>"}House Price", "Set the price of the house in the field below", "Set", "Cancel");
- else if(listitem == 2)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- if(hInfo[houseid][ForSale])
- {
- SetHouseForSale(houseid, 0);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}For Sale", "This house is no longer for sale!");
- }
- else
- {
- SetHouseForSale(houseid, 1);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}For Sale", "This house is now for sale!");
- }
- }
- else if(listitem == 3)
- ShowPlayerDialog(playerid, HOUSE_DIAG+7, DIALOG_STYLE_INPUT, "{"#B>"}House Edit - {"#G>"}Interior", "Set the Interior ID of the house in the field below", "Set", "Cancel");
- else if(listitem == 4)
- ShowPlayerDialog(playerid, HOUSE_DIAG+8, DIALOG_STYLE_INPUT, "{"#B>"}House Edit - {"#G>"}Virtual World", "Set the virtual world ID of the house in the field below", "Set", "Cancel");
- else if(listitem == 5)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:pcoords[4], key[75];
- GetPlayerPos(playerid, pcoords[0], pcoords[1], pcoords[2]);
- GetPlayerFacingAngle(playerid, pcoords[3]);
- format(key, sizeof(key), "%f,%f,%f,%f", pcoords[0], pcoords[1], pcoords[2], pcoords[3]);
- dini_Set(hfile, "EnterPos", key);
- hInfo[houseid][EnterPos][0] = pcoords[0];
- hInfo[houseid][EnterPos][1] = pcoords[1];
- hInfo[houseid][EnterPos][2] = pcoords[2];
- hInfo[houseid][EnterPos][3] = pcoords[3];
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Enter Position", "Enter position was successfully set!");
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}enter\n{"#W>"}position set here!", MSG_COLOR, hInfo[houseid][EnterPos][0], hInfo[houseid][EnterPos][1], hInfo[houseid][EnterPos][2], 0, -1, -1, 8000);
- }
- else if(listitem == 6)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:pcoords[4], key[75];
- GetPlayerPos(playerid, pcoords[0], pcoords[1], pcoords[2]);
- GetPlayerFacingAngle(playerid, pcoords[3]);
- format(key, sizeof(key), "%f,%f,%f,%f", pcoords[0], pcoords[1], pcoords[2], pcoords[3]);
- dini_Set(hfile, "ExitPos", key);
- hInfo[houseid][ExitPos][0] = pcoords[0];
- hInfo[houseid][ExitPos][1] = pcoords[1];
- hInfo[houseid][ExitPos][2] = pcoords[2];
- hInfo[houseid][ExitPos][3] = pcoords[3];
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Exit Position", "Exit position was successfully set!");
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}exit\n{"#W>"}position set here!", MSG_COLOR, hInfo[houseid][ExitPos][0], hInfo[houseid][ExitPos][1], hInfo[houseid][ExitPos][2], 0, -1, -1, 8000);
- }
- else if(listitem == 7)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:pcoords[4], key[75];
- GetPlayerPos(playerid, pcoords[0], pcoords[1], pcoords[2]);
- GetPlayerFacingAngle(playerid, pcoords[3]);
- format(key, sizeof(key), "%f,%f,%f,%f", pcoords[0], pcoords[1], pcoords[2], pcoords[3]);
- dini_Set(hfile, "SpawnPos", key);
- hInfo[houseid][SpawnPos][0] = pcoords[0];
- hInfo[houseid][SpawnPos][1] = pcoords[1];
- hInfo[houseid][SpawnPos][2] = pcoords[2];
- hInfo[houseid][SpawnPos][3] = pcoords[3];
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Spawn Position", "Spawn position was successfully set!");
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}spawn\n{"#W>"}position set here!", MSG_COLOR, hInfo[houseid][SpawnPos][0], hInfo[houseid][SpawnPos][1], hInfo[houseid][SpawnPos][2], 0, -1, -1, 8000);
- }
- else if(listitem == 8)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:pcoords[3], key[60];
- GetPlayerPos(playerid, pcoords[0], pcoords[1], pcoords[2]);
- format(key, sizeof(key), "%f,%f,%f", pcoords[0], pcoords[1], pcoords[2]);
- dini_Set(hfile, "PickupPos", key);
- hInfo[houseid][PickupPos][0] = pcoords[0];
- hInfo[houseid][PickupPos][1] = pcoords[1];
- hInfo[houseid][PickupPos][2] = pcoords[2];
- DestroyDynamicPickup(hInfo[houseid][Pickup]);
- DestroyDynamicMapIcon(hInfo[houseid][MapIcon]);
- if(dini_Int(hfile, "ForSale"))
- {
- hInfo[houseid][Pickup] = CreateDynamicPickup(FORSALE_PICKUP, 1, hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], 0, 0, -1, PICKUP_DRAW);
- hInfo[houseid][MapIcon] = CreateDynamicMapIcon(hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], FORSALE_ICON, 0, 0, 0, -1, ICON_DRAW);
- }
- else
- {
- hInfo[houseid][Pickup] = CreateDynamicPickup(NOTFORSALE_PICKUP, 1, hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], 0, 0, -1, PICKUP_DRAW);
- hInfo[houseid][MapIcon] = CreateDynamicMapIcon(hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], NOTFORSALE_ICON, 0, 0, 0, -1, ICON_DRAW);
- }
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Pickup Position", "Pickup position was successfully set!");
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}pickup\n{"#W>"}position set here!", MSG_COLOR, hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], 0, -1, -1, 8000);
- }
- else if(listitem == 9)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:pcoords[3], key[60];
- GetPlayerPos(playerid, pcoords[0], pcoords[1], pcoords[2]);
- format(key, sizeof(key), "%f,%f,%f", pcoords[0], pcoords[1], pcoords[2]);
- dini_Set(hfile, "LabelPos", key);
- hInfo[houseid][LabelPos][0] = pcoords[0];
- hInfo[houseid][LabelPos][1] = pcoords[1];
- hInfo[houseid][LabelPos][2] = pcoords[2];
- new str[140];
- format(str, sizeof(str), "{"#G>"}%s\n{"#B>"}Owner {"#W>"}%s\n{"#R>"}Price {"#W>"}$%d", hInfo[houseid][Name], hInfo[houseid][Owner], hInfo[houseid][Price]);
- DestroyDynamic3DTextLabel(hInfo[houseid][InfoLabel]);
- hInfo[houseid][InfoLabel] = CreateDynamic3DTextLabel(str, LABEL_COLOR, hInfo[houseid][LabelPos][0], hInfo[houseid][LabelPos][1], hInfo[houseid][LabelPos][2], LABEL_DRAW, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, LABEL_LOS, 0, 0, -1, LABEL_DRAW);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Label Position", "Label position was successfully set!");
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}label\n{"#W>"}position set here!", MSG_COLOR, hInfo[houseid][LabelPos][0], hInfo[houseid][LabelPos][1], hInfo[houseid][LabelPos][2], 0, -1, -1, 8000);
- }
- else if(listitem == 10)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:pcoords[3], key[60];
- GetPlayerPos(playerid, pcoords[0], pcoords[1], pcoords[2]);
- format(key, sizeof(key), "%f,%f,%f", pcoords[0], pcoords[1], pcoords[2]);
- dini_Set(hfile, "EnterCPPos", key);
- hInfo[houseid][EnterCPPos][0] = pcoords[0];
- hInfo[houseid][EnterCPPos][1] = pcoords[1];
- hInfo[houseid][EnterCPPos][2] = pcoords[2];
- DestroyDynamicCP(hInfo[houseid][EnterCP]);
- hInfo[houseid][EnterCP] = CreateDynamicCP(hInfo[houseid][EnterCPPos][0], hInfo[houseid][EnterCPPos][1], hInfo[houseid][EnterCPPos][2], ENTERCP_SIZE, -1, 0, -1, ENTERCP_DRAW);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Entrance Checkpoint Position", "{"#B>"}House Edit - {"#G>"}Entrance Checkpoint Position");
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}enter checkpoint\n{"#W>"}position set here!", MSG_COLOR, hInfo[houseid][EnterCPPos][0], hInfo[houseid][EnterCPPos][1], hInfo[houseid][EnterCPPos][2], 0, -1, -1, 8000);
- }
- else if(listitem == 11)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:pcoords[3], key[60];
- GetPlayerPos(playerid, pcoords[0], pcoords[1], pcoords[2]);
- format(key, sizeof(key), "%f,%f,%f", pcoords[0], pcoords[1], pcoords[2]);
- dini_Set(hfile, "ExitCPPos", key);
- dini_IntSet(hfile, "Interior", GetPlayerInterior(playerid));
- dini_IntSet(hfile, "World", GetPlayerVirtualWorld(playerid));
- hInfo[houseid][Interior] = GetPlayerInterior(playerid);
- hInfo[houseid][World] = GetPlayerVirtualWorld(playerid);
- hInfo[houseid][ExitCPPos][0] = pcoords[0];
- hInfo[houseid][ExitCPPos][1] = pcoords[1];
- hInfo[houseid][ExitCPPos][2] = pcoords[2];
- DestroyDynamicCP(hInfo[houseid][ExitCP]);
- hInfo[houseid][ExitCP] = CreateDynamicCP(hInfo[houseid][ExitCPPos][0], hInfo[houseid][ExitCPPos][1], hInfo[houseid][ExitCPPos][2], EXITCP_SIZE, hInfo[houseid][World], hInfo[houseid][Interior], -1, ENTERCP_DRAW);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Exit Checkpoint Position", "Exit Checkpoint position was successfully set!");
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}exit checkpoint\n{"#W>"}position set here!", MSG_COLOR, hInfo[houseid][ExitCPPos][0], hInfo[houseid][ExitCPPos][1], hInfo[houseid][ExitCPPos][2], 0, -1, -1, 8000);
- }
- else if(listitem == 12)
- ShowPlayerDialog(playerid, HOUSE_DIAG+9, DIALOG_STYLE_LIST, "{"#B>"}House Edit - {"#G>"}Teleport", "Pickup\nInformation Label\nEnter Checkpoint\nExit Checkpoint", "Go", "Cancel");
- else if(listitem == 13)
- {
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new Float:coords[4], key[80];
- if(!IsPlayerInAnyVehicle(playerid))
- {
- GetPlayerPos(playerid, coords[0], coords[1], coords[2]);
- GetPlayerFacingAngle(playerid, coords[3]);
- format(key, sizeof(key), "%f,%f,%f,%f", coords[0], coords[1], coords[2], coords[3]);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Vehicle Spawn Position", "{"#G>"}NOTE: It's preferable you set this position while in a vehicle!\n\n{"#W>"}Vehicle spawn position successfully set!");
- }
- else
- {
- new vehid = GetPlayerVehicleID(playerid);
- GetVehiclePos(vehid, coords[0], coords[1], coords[2]);
- GetVehicleZAngle(vehid, coords[3]);
- format(key, sizeof(key), "%f,%f,%f,%f", coords[0], coords[1], coords[2], coords[3]);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Vehicle Spawn Position", "Vehicle spawn position successfully set!");
- }
- dini_Set(hfile, "VehPos", key);
- hInfo[houseid][VehPos][0] = coords[0];
- hInfo[houseid][VehPos][1] = coords[1];
- hInfo[houseid][VehPos][2] = coords[2];
- hInfo[houseid][VehPos][3] = coords[3];
- CreateHouseNotice3DLabel(houseid, "{"#W>"}House {"#R>"}vehicle\n{"#W>"}position set here!", MSG_COLOR, coords[0], coords[1], coords[2], 0, -1, -1, 8000);
- }
- }
- else if(dialogid == HOUSE_DIAG+5)
- {
- if(response)
- {
- if(!strlen(inputtext) || strlen(inputtext) > MAX_HOUSE_NAME) return ShowPlayerDialog(playerid, HOUSE_DIAG+5, DIALOG_STYLE_INPUT, "House Edit - House Name", "ERROR: You must enter a house name under 40 characters!\n\nEnter a house name under 40 characters long in the field below", "Continue", "Cancel");
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- dini_Set(hfile, "Name", inputtext);
- format(hInfo[houseid][Name], MAX_HOUSE_NAME, "%s", inputtext);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}House Name", "House name was successfully set!");
- }
- else ShowEditDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+6)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+6, DIALOG_STYLE_INPUT, "{"#B>"}House Edit - {"#G>"}House Price", "ERROR: You must enter a price value!\n\nSet the price of the house in the field below", "Set", "Cancel");
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- dini_IntSet(hfile, "Price", strval(inputtext));
- hInfo[houseid][Price] = strval(inputtext);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}House Price", "House price was successfully set!");
- }
- }
- else if(dialogid == HOUSE_DIAG+7)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+7, DIALOG_STYLE_INPUT, "{"#B>"}House Edit - {"#G>"}Interior", "ERROR: You must enter an interior!\n\nSet the Interior ID of the house in the field below", "Set", "Cancel");
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- dini_IntSet(hfile, "Interior", strval(inputtext));
- hInfo[houseid][Interior] = strval(inputtext);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Interior", "Interior was successfully set!");
- }
- }
- else if(dialogid == HOUSE_DIAG+8)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+7, DIALOG_STYLE_INPUT, "{"#B>"}House Edit - {"#G>"}Virtual World", "ERROR: You must enter a virtual world!\n\nSet the Virtual World ID of the house in the field below", "Set", "Cancel");
- new houseid = BUILDID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- dini_IntSet(hfile, "World", strval(inputtext));
- hInfo[houseid][World] = strval(inputtext);
- NotifyDialog(playerid, "{"#B>"}House Edit - {"#G>"}Virtual World", "Virtual world was successfully set!");
- }
- }
- else if(dialogid == HOUSE_DIAG+9)
- {
- if(!response) return 1;
- new houseid = BUILDID(playerid);
- if(listitem == 0)
- SetPlayerPosEx(playerid, hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], 0.0, 0, 0);
- else if(listitem == 1)
- SetPlayerPosEx(playerid, hInfo[houseid][LabelPos][0], hInfo[houseid][LabelPos][1], hInfo[houseid][LabelPos][2], 0.0, 0, 0);
- else if(listitem == 2)
- SetPlayerPosEx(playerid, hInfo[houseid][EnterCPPos][0], hInfo[houseid][EnterCPPos][1], hInfo[houseid][EnterCPPos][2], 0.0, 0, 0);
- else if(listitem == 3)
- SetPlayerPosEx(playerid, hInfo[houseid][ExitCPPos][0], hInfo[houseid][ExitCPPos][1], hInfo[houseid][ExitCPPos][2], 0.0, hInfo[houseid][Interior], hInfo[houseid][World]);
- }
- else if(dialogid == HOUSE_DIAG+10)
- {
- if(!response) return 1;
- new houseid = HOUSEID(playerid);
- if(listitem == 0)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- if(hInfo[houseid][Locked] == 1 && dini_Isset(hfile, "Password")) return ShowPlayerDialog(playerid, HOUSE_DIAG+11, DIALOG_STYLE_INPUT, "{"#B>"}House Enter - {"#G>"}Password", "{"#W>"}Enter the house password below to enter!", "Enter", "Cancel");
- SetPlayerPosEx(playerid, hInfo[houseid][EnterPos][0], hInfo[houseid][EnterPos][1], hInfo[houseid][EnterPos][2], hInfo[houseid][EnterPos][3], hInfo[houseid][Interior], hInfo[houseid][World]);
- }
- else if(listitem == 1)
- {
- if(!IsHouseOwner(playerid, houseid)) return NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}Lock House", "You are not the owner of this house!");
- if(hInfo[houseid][Locked])
- {
- hInfo[houseid][Locked] = 0;
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}Lock House", "You have unlocked your house!");
- }
- else
- {
- hInfo[houseid][Locked] = 1;
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}Lock House", "You have locked your house!");
- }
- }
- else if(listitem == 2)
- {
- if(hInfo[houseid][ForSale] == 0) return NotifyDialog(playerid, "{"#B>"}House Enter - {"#G>"}Purchase", "{"#R>"}ERROR: This house is not for sale!");
- if(IsHouseOwner(playerid, houseid)) return NotifyDialog(playerid, "{"#B>"}House Enter - {"#G>"}Purchase", "{"#R>"}ERROR: You already own this house!");
- if(GetPlayerMoney(playerid) < hInfo[houseid][Price]) return NotifyDialog(playerid, "{"#B>"}House Enter - {"#G>"}Purchase", "{"#R>"}ERROR: You do not have enough money!");
- format(hfile, sizeof(hfile), HOUSE_FILE, HOUSEID(playerid));
- format(hInfo[houseid][Owner], MAX_PLAYER_NAME, "%s", pName(playerid));
- dini_Set(hfile, "Owner", pName(playerid));
- GivePlayerMoney(playerid, -hInfo[houseid][Price]);
- PlayerPlaySound(playerid, 1149, 0, 0, 0);
- new str[120];
- format(str, sizeof(str), "%s has purchased the house \"%s\" for {"#G>"}$%d!", pName(playerid), hInfo[houseid][Name], hInfo[houseid][Price]);
- SendClientMessageToAll(MSG_COLOR, str);
- format(str, sizeof(str), "{"#G>"}%s\n{"#B>"}Owner {"#W>"}%s\n{"#R>"}Price {"#W>"}$%d", hInfo[houseid][Name], hInfo[houseid][Owner], hInfo[houseid][Price]);
- DestroyDynamic3DTextLabel(hInfo[houseid][InfoLabel]);
- hInfo[houseid][InfoLabel] = CreateDynamic3DTextLabel(str, LABEL_COLOR, hInfo[houseid][LabelPos][0], hInfo[houseid][LabelPos][1], hInfo[houseid][LabelPos][2], LABEL_DRAW, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, LABEL_LOS, 0, 0, -1, LABEL_DRAW);
- }
- }
- else if(dialogid == HOUSE_DIAG+11)
- {
- if(response)
- {
- new houseid = HOUSEID(playerid);
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+11, DIALOG_STYLE_INPUT, "{"#B>"}House Enter - {"#G>"}Password", "{"#R>"}ERROR: You must enter the password to enter!\n\n{"#W>"}Enter the house password below to enter!", "Enter", "Cancel");
- if(!PasswordMatch(inputtext, houseid)) return ShowPlayerDialog(playerid, HOUSE_DIAG+11, DIALOG_STYLE_INPUT, "{"#B>"}House Enter - {"#G>"}Password", "{"#R>"}ERROR: Incorrect password\n\n{"#W>"}Enter the house password below to enter!", "Enter", "Cancel");
- SetPlayerPosEx(playerid, hInfo[houseid][EnterPos][0], hInfo[houseid][EnterPos][1], hInfo[houseid][EnterPos][2], hInfo[houseid][EnterPos][3], hInfo[houseid][Interior], hInfo[houseid][World]);
- }
- }
- else if(dialogid == HOUSE_DIAG+12)
- {
- if(!response) return 1;
- new houseid = HOUSEID(playerid);
- if(listitem == 0)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- format(hstr, sizeof(hstr), "House Name\t\t%s (ID %d)\nOwner\t\t\t%s\nBuilder\t\t\t%s\nPrice\t\t\t$%d\nFor Sale\t\t%d\nInterior\t\t%d\nWorld\t\t\t%d", hInfo[houseid][Name],
- houseid, hInfo[houseid][Owner], dini_Get(hfile, "Builder"), hInfo[houseid][Price], hInfo[houseid][ForSale], hInfo[houseid][Interior], hInfo[houseid][World]);
- ShowPlayerDialog(playerid, HOUSE_DIAG-1, DIALOG_STYLE_MSGBOX, "House Information", hstr, "Ok", "Exit");
- }
- else if(listitem == 1)
- {
- ShowPlayerDialog(playerid, HOUSE_DIAG+13, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}Set Password", "Enter a password for your house in the field below!", "Set", "Cancel");
- }
- else if(listitem == 2)
- {
- ShowPlayerDialog(playerid, HOUSE_DIAG+14, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}Set House Name", "Enter a house name in the field below!", "Set", "Cancel");
- }
- else if(listitem == 3)
- {
- ShowPlayerDialog(playerid, HOUSE_DIAG+15, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}Set House Price", "Enter a house price in the field below!", "Set", "Cancel");
- }
- else if(listitem == 4)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- if(hInfo[houseid][ForSale])
- {
- SetHouseForSale(houseid, 0);
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}For Sale", "Your house is no longer for sale!");
- }
- else
- {
- SetHouseForSale(houseid, 1);
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}For Sale", "Your house is now for sale!");
- }
- }
- else if(listitem == 5)
- {
- if(dini_Int(HUSER_FILE, pName(playerid)) == -1)
- {
- dini_IntSet(HUSER_FILE, pName(playerid), houseid);
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}House Spawn", "You will now spawn at this house on spawn!");
- }
- else
- {
- dini_IntSet(HUSER_FILE, pName(playerid), -1);
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}House Spawn", "You will no longer spawn at this house!");
- }
- }
- else if(listitem == 6)
- {
- new str[MAX_VEHICLE_SLOTS * 70];
- for(new x=0; x<MAX_VEHICLE_SLOTS; x++)
- {
- new vehid = hVeh[houseid][x][ModelID];
- format(str, sizeof(str), "%s{"#B>"}Slot %d\t{"#G>"}%s\n", str, x, VehicleNames[vehid-400]);
- }
- ShowPlayerDialog(playerid, HOUSE_DIAG+16, DIALOG_STYLE_LIST, "{"#B>"}House Settings - {"#G>"}House Vehicles", str, "Edit", "Cancel");
- }
- else if(listitem == 7)
- {
- new str[MAX_VEHICLE_SLOTS * 70];
- for(new x=0; x<MAX_VEHICLE_SLOTS; x++)
- {
- new vehid = hVeh[houseid][x][ModelID];
- format(str, sizeof(str), "%s{"#B>"}Slot %d\t{"#G>"}%s\n", str, x, VehicleNames[vehid-400]);
- }
- ShowPlayerDialog(playerid, HOUSE_DIAG+19, DIALOG_STYLE_LIST, "{"#B>"}House Settings - {"#G>"}Spawn House Vehicle", str, "Select", "Cancel");
- }
- else if(listitem == 8) //Show dialog with player's money (Store money/ take money)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new str[80];
- format(str, sizeof(str), "{"#G>"}[Current Money: $%d]\n{"#W>"}Store Money\nTake Money", hInfo[houseid][MoneyStash]);
- ShowPlayerDialog(playerid, HOUSE_DIAG+20, DIALOG_STYLE_LIST, "{"#B>"}House Storage - {"#G>"}Money Stash", str, "Select", "Cancel");
- }
- }
- else if(dialogid == HOUSE_DIAG+13)
- {
- if(response)
- {
- new houseid = HOUSEID(playerid);
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+13, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}Set Password", "{"#<R"}ERROR: You must enter a password!\n\n{"#<W"}Enter a password for your house in the field below!", "Set", "Cancel");
- if(strlen(inputtext) < MIN_PASS || strlen(inputtext) > MAX_PASS) return ShowPlayerDialog(playerid, HOUSE_DIAG+13, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}Set Password", "{"#<R"}ERROR: Password length must be between "#MIN_PASS"-"#MAX_PASS" characters!\n\n{"#<W"}Enter a password for your house in the field below!", "Set", "Cancel");
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- dini_IntSet(hfile, "Password", udb_hash(inputtext));
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}Set Password", "Password was set successfully!");
- }
- else ShowOptionsDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+14)
- {
- if(response)
- {
- new houseid = HOUSEID(playerid);
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+14, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - ""{"#B>"}House Settings - {"#G>"}Set House Name", "{"#<R"}ERROR: You must enter a house name!\n\n{"#<W"}Enter a house name in the field below!", "Set", "Cancel");
- if(strlen(inputtext) > MAX_HOUSE_NAME) return ShowPlayerDialog(playerid, HOUSE_DIAG+14, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - ""{"#B>"}House Settings - {"#G>"}Set House Name", "{"#<R"}ERROR: Maximum house name is "#MAX_HOUSE_NAME" characters!\n\n{"#<W"}Enter a house name in the field below!", "Set", "Cancel");
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- format(hInfo[houseid][Name], MAX_PLAYER_NAME, "%s", inputtext);
- dini_Set(hfile, "Name", inputtext);
- if(IsHousePropSet(houseid, "LabelPos"))
- {
- DestroyDynamic3DTextLabel(hInfo[houseid][InfoLabel]);
- format(hfile, sizeof(hfile), "{"#G>"}%s\n{"#B>"}Owner {"#W>"}%s\n{"#R>"}Price {"#W>"}$%d", hInfo[houseid][Name], hInfo[houseid][Owner], hInfo[houseid][Price]);
- hInfo[houseid][InfoLabel] = CreateDynamic3DTextLabel(hfile, LABEL_COLOR, hInfo[houseid][LabelPos][0], hInfo[houseid][LabelPos][1], hInfo[houseid][LabelPos][2], LABEL_DRAW, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, LABEL_LOS, 0, 0, -1, LABEL_DRAW);
- }
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}Set House Name", "House name was successfully set!");
- }
- else ShowOptionsDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+15)
- {
- if(response)
- {
- new houseid = HOUSEID(playerid);
- new price = strval(inputtext);
- if(!IsNumeric(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+15, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - ""{"#B>"}House Settings - {"#G>"}Set House Price", "{"#<R"}ERROR: You must enter a house price!\n\n{"#<W"}Enter a house price in the field below!", "Set", "Cancel");
- if(price < 0) return ShowPlayerDialog(playerid, HOUSE_DIAG+15, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - ""{"#B>"}House Settings - {"#G>"}Set House Price", "{"#<R"}ERROR: Please enter a valid price!\n\n{"#<W"}Enter a house price in the field below!", "Set", "Cancel");
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- dini_IntSet(hfile, "Price", price);
- hInfo[houseid][Price] = price;
- if(IsHousePropSet(houseid, "LabelPos"))
- {
- DestroyDynamic3DTextLabel(hInfo[houseid][InfoLabel]);
- format(hfile, sizeof(hfile), "{"#G>"}%s\n{"#B>"}Owner {"#W>"}%s\n{"#R>"}Price {"#W>"}$%d", hInfo[houseid][Name], hInfo[houseid][Owner], price);
- hInfo[houseid][InfoLabel] = CreateDynamic3DTextLabel(hfile, LABEL_COLOR, hInfo[houseid][LabelPos][0], hInfo[houseid][LabelPos][1], hInfo[houseid][LabelPos][2], LABEL_DRAW, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, LABEL_LOS, 0, 0, -1, LABEL_DRAW);
- }
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}Set House Price", "House price was successfully set!");
- }
- else ShowOptionsDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+16)
- {
- if(response)
- {
- new houseid = HOUSEID(playerid);
- new str[100], cvehid = hVeh[houseid][listitem][ModelID];
- SetPVarInt(playerid, "HVehSlot", listitem);
- format(str, sizeof(str), "{"#B>"}Set Vehicle Model\t{"#G>"}%s [ID %d]", VehicleNames[cvehid-400], cvehid);
- ShowPlayerDialog(playerid, HOUSE_DIAG+17, DIALOG_STYLE_LIST, "{"#B>"}House Vehicles - {"#G>"}Editing Slot", str, "Select", "Cancel");
- }
- else ShowOptionsDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+17)
- {
- if(response && listitem == 0)
- ShowPlayerDialog(playerid, HOUSE_DIAG+18, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}House Vehicles", "Enter a vehicle name or model id to continue", "Set", "Cancel");
- }
- else if(dialogid == HOUSE_DIAG+18)
- {
- if(!response) return 1;
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+18, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}House Vehicles", "{"#R>"}ERROR: You must enter a vehicle name or model id!\n\n{"#W>"}Enter a vehicle name or model id to continue", "Set", "Cancel");
- new vehid = GetVehicleModel2(inputtext);
- if(!IsValidVehicle(vehid) || !IsAllowedVehicle(vehid)) return ShowPlayerDialog(playerid, HOUSE_DIAG+18, DIALOG_STYLE_INPUT, "{"#B>"}House Settings - {"#G>"}House Vehicles", "{"#R>"}ERROR: This vehicle is either not allowed or does not exist!\n\n{"#W>"}Enter a vehicle name or model id to continue", "Set", "Cancel");
- new key[20];
- new houseid = HOUSEID(playerid);
- new vehslot = GetPVarInt(playerid, "HVehSlot");
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- format(key, sizeof(key), "VSlot%dModel", vehslot);
- dini_IntSet(hfile, key, vehid);
- hVeh[houseid][vehslot][ModelID] = vehid;
- NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}House Vehicles", "House vehicle model was successfully changed!");
- }
- else if(dialogid == HOUSE_DIAG+19)
- {
- new houseid = HOUSEID(playerid);
- if(response)
- {
- new key[20];
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- format(key, sizeof(key), "VSlot%dModel", listitem);
- if(!dini_Isset(hfile, key)) return NotifyDialog(playerid, "{"#B>"}House Settings - {"#G>"}Spawn House Vehicle", "{"#R>"}ERROR: This vehicle slot is not yet set, make sure to edit it first!");
- for(new x=0; x<MAX_VEHICLE_SLOTS; x++) DestroyVehicle(hVeh[houseid][x][Vehicle]);
- new vehid = dini_Int(hfile, key);
- hVeh[houseid][listitem][Vehicle] = CreateVehicle(vehid, hInfo[houseid][VehPos][0], hInfo[houseid][VehPos][1], hInfo[houseid][VehPos][2], hInfo[houseid][VehPos][3], random(120), random(120), 0);
- new str[115];
- format(str, sizeof(str), "Vehicle '%s' (Slot %d) was successfully spawned at your house location!", VehicleNames[vehid-400], listitem);
- SendClientMessage(playerid, MSG_COLOR, str);
- format(str, sizeof(str), "{"#B>"}Vehicle {"#G>"}'%s'\n{"#B>"}of {"#G>"}'Slot %d' {"#B>"}spawned!", VehicleNames[vehid-400], listitem);
- CreateHouseNotice3DLabel(houseid, str, MSG_COLOR, hInfo[houseid][VehPos][0], hInfo[houseid][VehPos][1], hInfo[houseid][VehPos][2], 0, -1, -1, 8000);
- PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
- }
- else ShowOptionsDialog(playerid);
- }
- else if(dialogid == HOUSE_DIAG+20)
- {
- if(!response) return 1;
- if(listitem == 0) return 1;
- if(listitem == 1) ShowPlayerDialog(playerid, HOUSE_DIAG+21, DIALOG_STYLE_INPUT, "{"#B>"}House Cash - {"#G>"}Store Cash", "{"#W>"}TIP: Enter an amount of cash over {"#G>"}$500\n{"#W>"}store in the house!", "Store", "Cancel");
- else if(listitem == 2) ShowPlayerDialog(playerid, HOUSE_DIAG+22, DIALOG_STYLE_INPUT, "{"#B>"}House Cash - {"#G>"}Take Cash", "{"#W>"}TIP: Enter an amount of cash to take from house!", "Take", "Cancel");
- }
- else if(dialogid == HOUSE_DIAG+21)
- {
- if(!response) return OnDialogResponse(playerid, HOUSE_DIAG+12, 1, 8, "");
- if(!strlen(inputtext) || !IsNumeric(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+21, DIALOG_STYLE_INPUT, "{"#B>"}House Cash - {"#G>"}Store Cash", "{"#R>"}ERROR: You must enter an amount!\n\n{"#W>"}Enter an amount of cash to store in the house!", "Store", "Cancel");
- new houseid = HOUSEID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new cash = strval(inputtext);
- if(cash < 500) return ShowPlayerDialog(playerid, HOUSE_DIAG+22, DIALOG_STYLE_INPUT, "{"#B>"}House Cash - {"#G>"}Take Cash", "{"#R>"}ERROR: You must enter an amount!\n\n{"#W>"}Enter an amount of cash to take from the house!", "Store", "Cancel");
- if(GetPlayerMoney(playerid) < cash) return ShowPlayerDialog(playerid, HOUSE_DIAG+21, DIALOG_STYLE_INPUT, "{"#B>"}House Cash - {"#G>"}Store Cash", "{"#R>"}ERROR: You do not have that much money!\n\n{"#W>"}Enter an amount of cash to store in the house!", "Store", "Cancel");
- hInfo[houseid][MoneyStash] += cash;
- GivePlayerMoney(playerid, -cash);
- dini_IntSet(hfile, "MoneyStash", hInfo[houseid][MoneyStash]);
- new str[100];
- format(str, sizeof(str), "{"#W>"}You stored {"#G>"}'$%d' {"#W>"}in your house!\n\n{"#G>"}[Current Money: $%d]", cash, hInfo[houseid][MoneyStash]);
- NotifyDialog(playerid, "{"#B>"}House Cash - {"#G>"}Store Cash", str);
- }
- else if(dialogid == HOUSE_DIAG+22)
- {
- if(!response) return OnDialogResponse(playerid, HOUSE_DIAG+12, 1, 8, "");
- if(!strlen(inputtext) || !IsNumeric(inputtext)) return ShowPlayerDialog(playerid, HOUSE_DIAG+22, DIALOG_STYLE_INPUT, "{"#B>"}House Cash - {"#G>"}Take Cash", "{"#R>"}ERROR: You must enter an amount over $500!\n\n{"#W>"}Enter an amount of cash to take from the house!", "Take", "Cancel");
- new houseid = HOUSEID(playerid);
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- new cash = strval(inputtext);
- if(hInfo[houseid][MoneyStash] < cash) return ShowPlayerDialog(playerid, HOUSE_DIAG+22, DIALOG_STYLE_INPUT, "{"#B>"}House Cash - {"#G>"}Take Cash", "{"#R>"}ERROR: You do not have that much money stored!\n\n{"#W>"}Enter an amount of cash to take from the house!", "Take", "Cancel");
- hInfo[houseid][MoneyStash] -= cash;
- GivePlayerMoney(playerid, cash);
- dini_IntSet(hfile, "MoneyStash", hInfo[houseid][MoneyStash]);
- new str[100];
- format(str, sizeof(str), "{"#W>"}You took {"#G>"}'$%d' {"#W>"}from your house!\n\n{"#G>"}[Current Money: $%d]", cash, hInfo[houseid][MoneyStash]);
- NotifyDialog(playerid, "{"#B>"}House Cash - {"#G>"}Take Cash", str);
- }
- return 0;
- }
- public OnPlayerUpdate(playerid)
- {
- if(inmenu[playerid] == 1 && !BUILDINGHOUSE(playerid))
- {
- new Float:crd[3];
- new houseid = HOUSEID(playerid);
- crd[0] = hInfo[houseid][PickupPos][0];
- crd[1] = hInfo[houseid][PickupPos][1];
- crd[2] = hInfo[houseid][PickupPos][2];
- if(!IsPlayerInRangeOfPoint(playerid, 1.1, crd[0], crd[1], crd[2])) inmenu[playerid] = 0;
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(GetPVarInt(playerid, "InIntView"))
- {
- new intid = GetPVarInt(playerid, "IntViewID");
- if(newkeys == KEY_JUMP) //Left
- {
- if(intid == 0) SetPVarInt(playerid, "IntViewID", 36);
- else SetPVarInt(playerid, "IntViewID", intid-1);
- UpdateIntScrollTextdraw(playerid);
- }
- else if(newkeys == KEY_SPRINT) //Right
- {
- if(intid == 36) SetPVarInt(playerid, "IntViewID", 0);
- else SetPVarInt(playerid, "IntViewID", intid+1);
- UpdateIntScrollTextdraw(playerid);
- }
- else if(newkeys == KEY_LOOK_BEHIND) //Spawn
- {
- SetPlayerPos(playerid, IntPos[intid][0], IntPos[intid][1], IntPos[intid][2]);
- SetPlayerInterior(playerid, IntID[intid]);
- TextDrawHideForPlayer(playerid, IntScrollTD);
- SetPVarInt(playerid, "InIntView", 0);
- SetCameraBehindPlayer(playerid);
- }
- }
- return 1;
- }
- public OnPlayerEnterDynamicCP(playerid, checkpointid)
- {
- for(new x=0; x<MAX_HOUSES; x++)
- {
- if(BUILDINGHOUSE(playerid)) break;
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) break;
- if(checkpointid == hInfo[x][EnterCP])
- {
- SetPVarInt(playerid, "HouseID", x);
- ShowPlayerDialog(playerid, HOUSE_DIAG+10, DIALOG_STYLE_LIST, "{"#G>"}House Entrance", "Enter House\nLock House\nPurchase House", "Select", "Cancel");
- break;
- }
- else if(checkpointid == hInfo[x][ExitCP])
- {
- SetPVarInt(playerid, "HouseID", x);
- SetPlayerPosEx(playerid, hInfo[x][ExitPos][0], hInfo[x][ExitPos][1], hInfo[x][ExitPos][2], hInfo[x][ExitPos][3], 0, 0);
- break;
- }
- }
- return 1;
- }
- public OnPlayerPickUpDynamicPickup(playerid, pickupid)
- {
- for(new x=0; x<MAX_HOUSES; x++)
- {
- if(BUILDINGHOUSE(playerid)) break;
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) break;
- if(pickupid == hInfo[x][Pickup] && IsHouseOwner(playerid, x) && inmenu[playerid] == 0)
- {
- inmenu[playerid] = 1;
- SetPVarInt(playerid, "HouseID", x);
- ShowOptionsDialog(playerid);
- break;
- }
- }
- return 1;
- }
- //=========[Functions]============
- stock ShowBuilderDialog(playerid)
- {
- ShowPlayerDialog(playerid, HOUSE_DIAG, DIALOG_STYLE_LIST, "{"#B>"}House Builder", "Build House\nEdit House\nDestroy House\nView House Info", "Select", "Exit");
- }
- stock ShowEditDialog(playerid)
- {
- #define EDITSTR "House Name\nPrice\nFor Sale\nInterior\nVirtual World\nEnter Position\nExit Position\nSpawn Position\nPickup Position\nLabel Position\nEnter Checkpoint\nExit Checkpoint\nTeleport\nVehicle Spawn Position"
- ShowPlayerDialog(playerid, HOUSE_DIAG+4, DIALOG_STYLE_LIST, "{"#B>"}House Builder - {"#G>"}Edit", EDITSTR, "Select", "Exit");
- }
- stock ShowOptionsDialog(playerid)
- {
- if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return 1;
- ShowPlayerDialog(playerid, HOUSE_DIAG+12, DIALOG_STYLE_LIST, "{"#G>"}House Settings", "House Information\nSet Password\nSet House Name\nSet House Price\nSet For Sale\nSpawn Here\nSet House Vehicles\nSpawn House Vehicle\nMoney Stash", "Select", "Cancel");
- return 1;
- }
- stock GetLowestOpenSlot()
- {
- new num;
- for(new x=0; x<MAX_HOUSES; x++)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, x);
- if(!dini_Exists(hfile))
- {
- num = x;
- break;
- }
- }
- return num;
- }
- stock PasswordMatch(password[], houseid)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- if(dini_Int(hfile, "Password") != udb_hash(password)) return 0;
- return 1;
- }
- stock IsHouseOwner(playerid, houseid)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- if(!dini_Exists(hfile) || !strlen(hInfo[houseid][Owner])) return 0;
- if(!strcmp(hInfo[houseid][Owner], pName(playerid), true, strlen(pName(playerid)))) return 1;
- return 0;
- }
- public SpawnPlayerAtHouse(playerid)
- {
- if(!IsPlayerToSpawnAtHouse(playerid)) return 1;
- new houseid = dini_Int(HUSER_FILE, pName(playerid));
- if(!IsHouseOwner(playerid, houseid)) return 1;
- SetPlayerPosEx(playerid, hInfo[houseid][SpawnPos][0], hInfo[houseid][SpawnPos][1], hInfo[houseid][SpawnPos][2], 0.0, hInfo[houseid][Interior], hInfo[houseid][World]);
- return 1;
- }
- stock IsPlayerToSpawnAtHouse(playerid)
- {
- if(!dini_Exists(HUSER_FILE)) return 0;
- if(dini_Int(HUSER_FILE, pName(playerid)) == -1) return 0;
- if(!IsHouseOwner(playerid, dini_Int(HUSER_FILE, pName(playerid)))) return 0;
- return 1;
- }
- stock LoadIntScrollTextdraw()
- {
- IntScrollTD = TextDrawCreate(250.000000, 342.000000, "noob");
- TextDrawBackgroundColor(IntScrollTD, 255);
- TextDrawFont(IntScrollTD, 3);
- TextDrawLetterSize(IntScrollTD, 0.500000, 1.000000);
- TextDrawColor(IntScrollTD, -1);
- TextDrawSetOutline(IntScrollTD, 0);
- TextDrawSetProportional(IntScrollTD, 1);
- TextDrawSetShadow(IntScrollTD, 1);
- TextDrawHideForAll(IntScrollTD);
- }
- stock UpdateIntScrollTextdraw(playerid)
- {
- TextDrawHideForPlayer(playerid, IntScrollTD);
- new str[140];
- new intid = GetPVarInt(playerid, "IntViewID");
- format(str, sizeof(str), "Scroll with~n~~<~ ~p~~k~~PED_JUMPING~ - ~g~~k~~PED_SPRINT~ ~>~~n~~r~Interior ID ~y~%d~n~~w~Press ~k~~PED_LOOKBEHIND~ to spawn", intid);
- TextDrawSetString(IntScrollTD, str);
- TextDrawShowForPlayer(playerid, IntScrollTD);
- SetPlayerInterior(playerid, IntID[intid]);
- SetPlayerCameraPos(playerid, IntPos[intid][0], IntPos[intid][1], IntPos[intid][2]);
- SetPlayerCameraLookAt(playerid, IntPos[intid][0], IntPos[intid][1], IntPos[intid][2]);
- }
- stock DeleteHouse(houseid)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- dini_Remove(hfile);
- format(hInfo[houseid][Name], MAX_HOUSE_NAME, "_");
- format(hInfo[houseid][Owner], MAX_PLAYER_NAME, "_");
- hInfo[houseid][Price] = 0;
- hInfo[houseid][ForSale] = 0;
- hInfo[houseid][Interior] = 0;
- hInfo[houseid][World] = 0;
- hInfo[houseid][Locked] = 0;
- for(new x=0; x<3; x++)
- {
- hInfo[houseid][EnterPos][x] = 0.0;
- hInfo[houseid][ExitPos][x] = 0.0;
- hInfo[houseid][SpawnPos][x] = 0.0;
- hInfo[houseid][PickupPos][x] = 0.0;
- hInfo[houseid][LabelPos][x] = 0.0;
- hInfo[houseid][EnterCPPos][x] = 0.0;
- hInfo[houseid][ExitCPPos][x] = 0.0;
- }
- DestroyDynamicCP(hInfo[houseid][EnterCP]);
- DestroyDynamicCP(hInfo[houseid][ExitCP]);
- DestroyDynamicPickup(hInfo[houseid][Pickup]);
- DestroyDynamicMapIcon(hInfo[houseid][MapIcon]);
- DestroyDynamic3DTextLabel(hInfo[houseid][InfoLabel]);
- return 1;
- }
- stock SetHouseForSale(houseid, value)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- if(value == 0)
- {
- dini_IntSet(hfile, "ForSale", 0);
- hInfo[houseid][ForSale] = 0;
- DestroyDynamicPickup(hInfo[houseid][Pickup]);
- DestroyDynamicMapIcon(hInfo[houseid][MapIcon]);
- hInfo[houseid][Pickup] = CreateDynamicPickup(NOTFORSALE_PICKUP, 1, hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], 0, 0, -1, PICKUP_DRAW);
- hInfo[houseid][MapIcon] = CreateDynamicMapIcon(hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], NOTFORSALE_ICON, 0, 0, 0, -1, ICON_DRAW);
- }
- if(value == 1)
- {
- dini_IntSet(hfile, "ForSale", 1);
- hInfo[houseid][ForSale] = 1;
- DestroyDynamicPickup(hInfo[houseid][Pickup]);
- DestroyDynamicMapIcon(hInfo[houseid][MapIcon]);
- hInfo[houseid][Pickup] = CreateDynamicPickup(FORSALE_PICKUP, 1, hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], 0, 0, -1, PICKUP_DRAW);
- hInfo[houseid][MapIcon] = CreateDynamicMapIcon(hInfo[houseid][PickupPos][0], hInfo[houseid][PickupPos][1], hInfo[houseid][PickupPos][2], FORSALE_ICON, 0, 0, 0, -1, ICON_DRAW);
- }
- return 0;
- }
- LoadHouses()
- {
- for(new x=0; x<MAX_HOUSES; x++)
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, x);
- if(!fexist(hfile)) continue;
- format(hInfo[x][Name], MAX_HOUSE_NAME, "%s", dini_Get(hfile, "Name"));
- format(hInfo[x][Owner], MAX_PLAYER_NAME, "%s", dini_Get(hfile, "Owner"));
- hInfo[x][Price] = dini_Int(hfile, "Price");
- hInfo[x][ForSale] = dini_Int(hfile, "ForSale");
- hInfo[x][Interior] = dini_Int(hfile, "Interior");
- hInfo[x][World] = dini_Int(hfile, "World");
- hInfo[x][Locked] = dini_Int(hfile, "Locked");
- hInfo[x][MoneyStash] = dini_Int(hfile, "MoneyStash");
- for(new z=0; z<MAX_VEHICLE_SLOTS; z++)
- {
- new key[20];
- format(key, sizeof(key), "VSlot%dModel", z);
- if(!dini_Isset(hfile, key)) dini_IntSet(hfile, key, 429); //Prevent spawn vehicle dialog bug
- hVeh[x][z][ModelID] = dini_Int(hfile, key);
- }
- if(IsHousePropSet(x, "EnterPos")) sscanf(dini_Get(hfile, "EnterPos"), "p<,>ffff", hInfo[x][EnterPos][0], hInfo[x][EnterPos][1], hInfo[x][EnterPos][2], hInfo[x][EnterPos][3]);
- if(IsHousePropSet(x, "ExitPos")) sscanf(dini_Get(hfile, "ExitPos"), "p<,>ffff", hInfo[x][ExitPos][0], hInfo[x][ExitPos][1], hInfo[x][ExitPos][2], hInfo[x][ExitPos][3]);
- if(IsHousePropSet(x, "SpawnPos")) sscanf(dini_Get(hfile, "SpawnPos"), "p<,>ffff", hInfo[x][SpawnPos][0], hInfo[x][SpawnPos][1], hInfo[x][SpawnPos][2], hInfo[x][SpawnPos][3]);
- if(IsHousePropSet(x, "PickupPos")) sscanf(dini_Get(hfile, "PickupPos"), "p<,>fff", hInfo[x][PickupPos][0], hInfo[x][PickupPos][1], hInfo[x][PickupPos][2]);
- if(IsHousePropSet(x, "LabelPos")) sscanf(dini_Get(hfile, "LabelPos"), "p<,>fff", hInfo[x][LabelPos][0], hInfo[x][LabelPos][1], hInfo[x][LabelPos][2]);
- if(IsHousePropSet(x, "EnterCPPos")) sscanf(dini_Get(hfile, "EnterCPPos"), "p<,>fff", hInfo[x][EnterCPPos][0], hInfo[x][EnterCPPos][1], hInfo[x][EnterCPPos][2]);
- if(IsHousePropSet(x, "ExitCPPos")) sscanf(dini_Get(hfile, "ExitCPPos"), "p<,>fff", hInfo[x][ExitCPPos][0], hInfo[x][ExitCPPos][1], hInfo[x][ExitCPPos][2]);
- if(IsHousePropSet(x, "VehPos")) sscanf(dini_Get(hfile, "VehPos"), "p<,>ffff", hInfo[x][VehPos][0], hInfo[x][VehPos][1], hInfo[x][VehPos][2], hInfo[x][VehPos][3]);
- if(IsHousePropSet(x, "ForSale"))
- {
- if(dini_Int(hfile, "ForSale"))
- {
- hInfo[x][Pickup] = CreateDynamicPickup(FORSALE_PICKUP, 1, hInfo[x][PickupPos][0], hInfo[x][PickupPos][1], hInfo[x][PickupPos][2], 0, 0, -1, PICKUP_DRAW);
- hInfo[x][MapIcon] = CreateDynamicMapIcon(hInfo[x][PickupPos][0], hInfo[x][PickupPos][1], hInfo[x][PickupPos][2], FORSALE_ICON, 0, 0, 0, -1, ICON_DRAW);
- }
- else
- {
- hInfo[x][Pickup] = CreateDynamicPickup(NOTFORSALE_PICKUP, 1, hInfo[x][PickupPos][0], hInfo[x][PickupPos][1], hInfo[x][PickupPos][2], 0, 0, -1, PICKUP_DRAW);
- hInfo[x][MapIcon] = CreateDynamicMapIcon(hInfo[x][PickupPos][0], hInfo[x][PickupPos][1], hInfo[x][PickupPos][2], NOTFORSALE_ICON, 0, 0, 0, -1, ICON_DRAW);
- }
- }
- if(IsHousePropSet(x, "EnterCPPos")) hInfo[x][EnterCP] = CreateDynamicCP(hInfo[x][EnterCPPos][0], hInfo[x][EnterCPPos][1], hInfo[x][EnterCPPos][2], ENTERCP_SIZE, -1, 0, -1, ENTERCP_DRAW);
- if(IsHousePropSet(x, "ExitCPPos")) hInfo[x][ExitCP] = CreateDynamicCP(hInfo[x][ExitCPPos][0], hInfo[x][ExitCPPos][1], hInfo[x][ExitCPPos][2], EXITCP_SIZE, hInfo[x][World], hInfo[x][Interior], -1, ENTERCP_DRAW);
- if(IsHousePropSet(x, "LabelPos"))
- {
- new str[125];
- format(str, sizeof(str), "{"#G>"}%s\n{"#B>"}Owner {"#W>"}%s\n{"#R>"}Price {"#W>"}$%d", hInfo[x][Name], hInfo[x][Owner], hInfo[x][Price]);
- hInfo[x][InfoLabel] = CreateDynamic3DTextLabel(str, LABEL_COLOR, hInfo[x][LabelPos][0], hInfo[x][LabelPos][1], hInfo[x][LabelPos][2], LABEL_DRAW, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, LABEL_LOS, 0, 0, -1, LABEL_DRAW);
- }
- }
- return 1;
- }
- stock IsHousePropSet(houseid, key[])
- {
- format(hfile, sizeof(hfile), HOUSE_FILE, houseid);
- return dini_Isset(hfile, key);
- }
- //=====[Internal Functions]=====
- stock IsValidVehicle(modelid)
- {
- switch(modelid)
- {
- case 581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 509, 481, 510, 472, 473, 493, 595, 484, 430, 453,
- 452, 446, 454, 445, 602, 416, 485, 568, 429, 433, 499, 424, 536, 496, 504, 422, 609, 498, 401, 575, 518,
- 402, 541, 482, 431, 438, 457, 527, 483, 524, 415, 542, 589, 437, 532, 480, 596, 599, 597, 598, 578, 486,
- 507, 562, 585, 427, 419, 587, 490, 528, 533, 544, 407, 565, 455, 530, 526, 466, 604, 492, 474, 588, 434,
- 502, 503, 494, 579, 545, 411, 546, 559, 508, 571, 400, 403, 517, 410, 551, 500, 418, 572, 423, 414, 516,
- 582, 467, 443, 470, 404, 514, 603, 600, 413, 426, 436, 547, 489, 441, 594, 564, 515, 479, 534, 432, 505,
- 442, 440, 475, 543, 605, 495, 567, 428, 405, 535, 458, 580, 439, 561, 409, 560, 506, 601, 574, 566, 549,
- 420, 459, 576, 525, 531, 408, 583, 451, 558, 552, 540, 491, 412, 478, 421, 529, 456, 554, 477, 548, 425,
- 417, 487, 497, 563, 501, 465, 447, 469, 488, 406, 573, 444, 556, 557, 592, 577, 511, 512, 593, 520, 553,
- 464, 476, 519, 460, 513, 539, 471, 435, 450, 591, 606, 607, 610, 584, 608, 611, 590, 449: return 1;
- default: return 0;
- }
- return 0;
- }
- stock IsAllowedVehicle(vehicleid)
- {
- switch(vehicleid)
- {
- case 520, 407, 425, 427, 432, 441, 447, 449, 464, 465, 476, 501, 537, 538, 564, 569, 570, 590, 592, 601, 577: return 0;
- default: return 1;
- }
- return 1;
- }
- stock GetVehicleModel2(vname[])
- {
- if(IsNumeric(vname)) return strval(vname);
- for(new i = 0; i < 211; i++)
- {
- if(strfind(VehicleNames[i], vname, true) != -1)
- return i + 400;
- }
- return -1;
- }
- stock udb_hash(buf[])
- {
- new length = strlen(buf);
- new s1 = 1;
- new s2 = 0;
- new n;
- for (n=0; n<length; n++) {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- IsNumeric(const string[])
- {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
- stock pName(playerid)
- {
- new aname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, aname, sizeof(aname));
- return aname;
- }
- stock NotifyDialog(playerid, title[], content[])
- {
- return ShowPlayerDialog(playerid, HOUSE_DIAG-1, DIALOG_STYLE_MSGBOX, title, content, "Exit", "");
- }
- stock SetPlayerPosEx(playerid, Float:x, Float:y, Float:z, Float:angle, interior, world)
- {
- SetPlayerPos(playerid, x, y, z);
- SetPlayerFacingAngle(playerid, angle);
- SetPlayerInterior(playerid, interior);
- SetPlayerVirtualWorld(playerid, world);
- }
- CreateHouseNotice3DLabel(houseid, str[], labelcolor, Float:X, Float:Y, Float:Z, labellos, virtualworld, interior, ms)
- {
- DestroyDynamic3DTextLabel(hInfo[houseid][NoticeLabel]);
- hInfo[houseid][NoticeLabel] = CreateDynamic3DTextLabel(str, labelcolor, X, Y, Z, LABEL_DRAW, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, labellos, virtualworld, interior, -1, LABEL_DRAW);
- SetTimerEx("HideHouseNotice3DLabel", ms, 0, "d", houseid);
- }
- forward HideHouseNotice3DLabel(houseid);
- public HideHouseNotice3DLabel(houseid)
- {
- DestroyDynamic3DTextLabel(hInfo[houseid][NoticeLabel]);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement