Mciko123

[PAWN] House system (v1.0)

Oct 24th, 2016
1,649
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.57 KB | None | 0 0
  1. /*
  2. Okay. This house system v1.0 by Micko. In this house system you ca do following:
  3.  
  4. if you are admin:
  5. Create House
  6. Edit House
  7. Port to house (soon)
  8. Sell Anyones House (soon)
  9.  
  10. everyone else
  11. Buy House
  12. You can put:
  13. Drugs
  14. Money
  15. Weapons
  16. Skin
  17. Change Interior
  18. Upgrade it
  19. Bell
  20. Fridge
  21. Unlock
  22. Lock
  23. Allow/Forbidd rent in your house
  24.  
  25. I hope this system will help to you guys. This is v1.0 but i might upgrade it :)
  26.  
  27. If you find any bugs PM me on: http://forum.sa-mp.com/
  28.  
  29. My account: http://forum.sa-mp.com/member.php?u=275247
  30.  
  31. If you are going to edit it at lease leave me in credits in comments :)
  32. */
  33.  
  34. #include < a_samp >
  35. #include < foreach >
  36. #include < streamer >
  37. #include < YSI\y_ini >
  38. #include < sscanf2 >
  39. #include < zcmd >
  40.  
  41. //============================== [ Dialogs ] ===================================//
  42. #define DIALOG_HOUSE 1
  43. #define DIALOG_HINFO 2
  44. #define DIALOG_HPUT 3
  45. #define DIALOG_HPMONEY 4
  46. #define DIALOG_HPDRUGS 5
  47. #define DIALOG_HTAKE 6
  48. #define DIALOG_HTMONEY 7
  49. #define DIALOG_HTDRUGS 8
  50. #define DIALOG_HSELL 9
  51. #define DIALOG_HRENT 10
  52. #define DIALOG_HUPGRADE 11
  53. #define DIALOG_HFOOD 12
  54.  
  55. //================================ [ Colors] ===================================//
  56. #define HGREEN "{04CC29}"
  57. #define WHITE "{FFFFFF}"
  58.  
  59. //============================= [ Player Enum ] ================================//
  60. //You need this player enum because without it you can't save player's house, rent and drugs :)
  61. //I was lazy to make saving system for player so make you go and make one ;)
  62. enum pInfo
  63. {
  64. pHouseOwner,
  65. pRenting,
  66. pDrugs
  67. };
  68. new PlayerInfo[MAX_PLAYERS][pInfo];
  69. //============================= [ House Enum ] =================================//
  70. #define HOUSE_FILE "Houses/%d.ini"
  71. #define MAX_HOUSES 300
  72.  
  73. enum Houses
  74. {
  75. hIsOwned,
  76. hOwner[MAX_PLAYER_NAME],
  77. hType[35],
  78. Float:hEnterX,
  79. Float:hEnterY,
  80. Float:hEnterZ,
  81. Float:hExitX,
  82. Float:hExitY,
  83. Float:hExitZ,
  84. hLevel,
  85. hPrice,
  86. hMoney,
  87. hInt,
  88. hLocked,
  89. hVW,
  90. hWeapons,
  91. hAmmo,
  92. hRent,
  93. hRentPrice,
  94. hBell,
  95. hFridge,
  96. hDrugs,
  97. hSkin,
  98. hIntType,
  99. hFood
  100. };
  101. new HouseInfo[MAX_HOUSES][Houses];
  102. new HousePickup[sizeof(HouseInfo)];
  103. new Text3D:HouseLabel[sizeof(HouseInfo)];
  104.  
  105. public OnFilterScriptInit()
  106. {
  107. for(new h = 0; h < sizeof(HouseInfo); h++)
  108. {
  109. new hFile[80], string[500];
  110. format(hFile, sizeof(hFile), HOUSE_FILE, h);
  111. if(fexist(hFile))
  112. {
  113. INI_ParseFile(hFile, "LoadHouses", .bExtra = true, .extra = h);
  114. if(HouseInfo[h][hIsOwned] == 0)
  115. {
  116. format(string, sizeof(string), ""HGREEN"House on Sale!\nType: "WHITE"%s\n"HGREEN"Price: "WHITE"%d$\n"HGREEN"Level: "WHITE"%d\n"HGREEN"To buy house type /buyhouse",HouseInfo[h][hType], HouseInfo[h][hPrice], HouseInfo[h][hLevel]);
  117. HouseLabel[h] = Create3DTextLabel(string, 0x33CCFFAA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 30.0, 0, 1);
  118. HousePickup[h] = CreateDynamicPickup(1237, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
  119. }
  120. else if(HouseInfo[h][hIsOwned] == 1)
  121. {
  122. if(HouseInfo[h][hRent] == 0)
  123. {
  124. format(string, sizeof(string), ""HGREEN"Owner: "WHITE"%s\n"HGREEN"Type: "WHITE"%s\n"HGREEN"Level: "WHITE"%d\n"HGREEN"Price: "WHITE"%d$\n", HouseInfo[h][hOwner], HouseInfo[h][hType], HouseInfo[h][hLevel], HouseInfo[h][hPrice]);
  125. }
  126. else if(HouseInfo[h][hRent] == 1)
  127. {
  128. format(string, sizeof(string), ""HGREEN"Owner: "WHITE"%s\n"HGREEN"Type: "WHITE"%s\n"HGREEN"Level: "WHITE"%d\n"HGREEN"Price: "WHITE"%d$\n"HGREEN"Rent Price: "WHITE"%d$\n"HGREEN"To rent house type /renthouse", HouseInfo[h][hOwner], HouseInfo[h][hType], HouseInfo[h][hLevel], HouseInfo[h][hPrice]);
  129. }
  130. HouseLabel[h] = Create3DTextLabel(string, 0x33CCFFAA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 30.0, 0, 1);
  131. HousePickup[h] = CreateDynamicPickup(1239, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
  132. }
  133. }
  134. }
  135. return 1;
  136. }
  137.  
  138. public OnFilterScriptExit()
  139. {
  140. for(new h = 0; h < sizeof(HouseInfo); h++)
  141. {
  142. SaveHouse(h);
  143. }
  144. return 1;
  145. }
  146.  
  147. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  148. {
  149. if(dialogid == DIALOG_HOUSE)
  150. {
  151. if(!response)
  152. {
  153. return 1;
  154. }
  155. if(response)
  156. {
  157. new i = PlayerInfo[playerid][pHouseOwner];
  158. switch(listitem)
  159. {
  160. case 0:
  161. {
  162. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  163. {
  164. SendClientMessage(playerid, -1, "You are not in your house");
  165. return 1;
  166. }
  167. new string1[275], string2[275], string[550], z[4], o[4], g[4];
  168. if(HouseInfo[i][hLocked] == 1)
  169. {
  170. z = "Yes";
  171. }
  172. else
  173. {
  174. z = "No";
  175. }
  176. if(HouseInfo[i][hSkin] == 1)
  177. {
  178. o = "No";
  179. }
  180. else
  181. {
  182. o = "Yes";
  183. }
  184. if(HouseInfo[i][hWeapons] == -1)
  185. {
  186. g = "No";
  187. }
  188. else
  189. {
  190. g = "Yes";
  191. }
  192. format(string1, sizeof(string1), ""WHITE"_______________________________________\n\n"HGREEN"Owner: "WHITE"%s\n"HGREEN"Level: "WHITE"%d\n"HGREEN"Price: "WHITE"%d$\n"HGREEN"Rent Price: "WHITE"%d\n", HouseInfo[i][hOwner], HouseInfo[i][hLevel], HouseInfo[i][hPrice], HouseInfo[i][hRentPrice]);
  193. format(string2, sizeof(string2), ""HGREEN"ID: "WHITE"%d\n"HGREEN"Locked: "WHITE"%s\n"HGREEN"Money: "WHITE"%d\n"HGREEN"Drugs: "WHITE"%d\n"HGREEN"Skin: "WHITE"%s\n"HGREEN"Weapons: "WHITE"%s\n_______________________________________",i, z, HouseInfo[i][hMoney], HouseInfo[i][hDrugs], o, g);
  194. format(string, sizeof(string), "%s%s", string1, string2);
  195. ShowPlayerDialog(playerid, DIALOG_HINFO, DIALOG_STYLE_MSGBOX, ""WHITE"House Info", string, "Ok", "Exit");
  196. }
  197. case 1:
  198. {
  199. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  200. {
  201. SendClientMessage(playerid, -1, "You are not in your house");
  202. return 1;
  203. }
  204. if(HouseInfo[i][hLocked] == 0)
  205. {
  206. SendClientMessage(playerid, -1, "House is allready unlocked");
  207. return 1;
  208. }
  209. HouseInfo[i][hLocked] = 0;
  210. SaveHouse(i);
  211. SendClientMessage(playerid, -1, "House unlocked");
  212. }
  213. case 2:
  214. {
  215. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  216. {
  217. SendClientMessage(playerid, -1, "You are not in your house");
  218. return 1;
  219. }
  220. if(HouseInfo[i][hLocked] == 1)
  221. {
  222. SendClientMessage(playerid, -1, "House is allready locked");
  223. return 1;
  224. }
  225. HouseInfo[i][hLocked] = 1;
  226. SaveHouse(i);
  227. SendClientMessage(playerid, -1, "House locked");
  228. }
  229. case 3:
  230. {
  231. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  232. {
  233. SendClientMessage(playerid, -1, "You are not in your house");
  234. return 1;
  235. }
  236. ShowPlayerDialog(playerid, DIALOG_HPUT, DIALOG_STYLE_LIST, ""WHITE"Put in house", ""HGREEN"(1). "WHITE"Money\n"HGREEN"(2). "WHITE"Drugs\n"HGREEN"(3). "WHITE"Skin\n"HGREEN"(4). "WHITE"Weapons", "Ok", "Leave");
  237. }
  238. case 4:
  239. {
  240. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  241. {
  242. SendClientMessage(playerid, -1, "You are not in your house");
  243. return 1;
  244. }
  245. ShowPlayerDialog(playerid, DIALOG_HTAKE, DIALOG_STYLE_LIST, ""WHITE"Put in house", ""HGREEN"(1). "WHITE"Money\n"HGREEN"(2). "WHITE"Drugs\n"HGREEN"(3). "WHITE"Skin\n"HGREEN"(4). "WHITE"Weapons", "Ok", "Leave");
  246. }
  247. case 5:
  248. {
  249. if(PlayerInfo[playerid][pHouseOwner] == -1)
  250. {
  251. SendClientMessage(playerid, -1, "You don't have any houses");
  252. return 1;
  253. }
  254. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  255. {
  256. SendClientMessage(playerid, -1, "You need to be outside of your house");
  257. return 1;
  258. }
  259. new price1 = (HouseInfo[i][hPrice] / 4) * 2;
  260. new string[256];
  261. format(string, sizeof(string), ""WHITE"Selling house to the state\n\n"HGREEN"Are you sure you want to sell your house to state for %d$!\n\n"WHITE"If you want to then click on 'Sell' if not click on 'Exit'", price1);
  262. ShowPlayerDialog(playerid, DIALOG_HSELL, DIALOG_STYLE_MSGBOX, ""WHITE"Selling house to the state", string, "Sell", "Exit");
  263. }
  264. case 6:
  265. {
  266. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  267. {
  268. SendClientMessage(playerid, -1, "You are not in your house");
  269. return 1;
  270. }
  271. if(HouseInfo[i][hRent] == 0)
  272. {
  273. HouseInfo[i][hRent] = 1;
  274. SaveHouse(i);
  275. HouseLP(i);
  276. SendClientMessage(playerid, -1, "Your house is now rentable");
  277. }
  278. else if(HouseInfo[i][hRent] == 1)
  279. {
  280. HouseInfo[i][hRent] = 0;
  281. SaveHouse(i);
  282. HouseLP(i);
  283. SendClientMessage(playerid, -1, "Your house is not rentable anymore");
  284. }
  285. }
  286. case 7:
  287. {
  288. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  289. {
  290. SendClientMessage(playerid, -1, "You are not in your house");
  291. return 1;
  292. }
  293. if(HouseInfo[i][hRent] == 0)
  294. {
  295. SendClientMessage(playerid, -1, "To ajust rent price you need to allo rent to your house");
  296. return 1;
  297. }
  298. ShowPlayerDialog(playerid, DIALOG_HRENT, DIALOG_STYLE_INPUT, ""HGREEN"Rent Price", ""WHITE"Please enter new rent price", "Set", "Leave");
  299. }
  300. case 8:
  301. {
  302. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]))
  303. {
  304. SendClientMessage(playerid, -1, "You need to be outside of your house");
  305. return 1;
  306. }
  307. new string5[256];
  308. format(string5, sizeof(string5), ""HGREEN"(1). "WHITE"Bell (2000$)\n"HGREEN"(2). "WHITE"Fridge (3000$)\n"HGREEN"(3). "WHITE"Standard Interior\n"HGREEN"(4). "WHITE"Interior 2 (30000$)\n"HGREEN"(5). "WHITE"Interior 3 (40000$)");
  309. ShowPlayerDialog(playerid, DIALOG_HUPGRADE, DIALOG_STYLE_LIST, ""WHITE"House upgrading", string5, "Ok", "Exit");
  310. }
  311. case 9:
  312. {
  313. if(!IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]))
  314. {
  315. SendClientMessage(playerid, -1, "You are not in your house");
  316. return 1;
  317. }
  318. if(HouseInfo[i][hFridge] == 0)
  319. {
  320. SendClientMessage(playerid, -1, "You don't have fridge");
  321. return 1;
  322. }
  323. ShowPlayerDialog(playerid, DIALOG_HFOOD, DIALOG_STYLE_LIST, ""WHITE"Food", ""HGREEN"(1). "WHITE"Take food\n"HGREEN"(2). "WHITE"Put food in fridge", "Ok", "Exit");
  324. }
  325. }
  326. }
  327. }
  328. ////////////////////////////////////////////////////////////////////////////////////
  329. if(dialogid == DIALOG_HUPGRADE)
  330. {
  331. if(!response)
  332. {
  333. return 1;
  334. }
  335. if(response)
  336. {
  337. if(PlayerInfo[playerid][pHouseOwner] == -1)
  338. {
  339. SendClientMessage(playerid, -1, "You don't have house");
  340. return 1;
  341. }
  342. new i = PlayerInfo[playerid][pHouseOwner];
  343. switch(listitem)
  344. {
  345. case 0:
  346. {
  347. if(HouseInfo[i][hBell] == 1)
  348. {
  349. SendClientMessage(playerid, -1, "You allready have a bell");
  350. return 1;
  351. }
  352. if(GetPlayerMoney(playerid) < 2000)
  353. {
  354. SendClientMessage(playerid, -1, "You don't have enough money");
  355. return 1;
  356. }
  357. HouseInfo[i][hBell] = 1;
  358. GivePlayerMoney(playerid, -2000);
  359. SaveHouse(i);
  360. SendClientMessage(playerid, -1, "Your house have a bell now");
  361. }
  362. case 1:
  363. {
  364. if(HouseInfo[i][hFridge] == 1)
  365. {
  366. SendClientMessage(playerid, -1, "You allreade have a fridge");
  367. return 1;
  368. }
  369. if(GetPlayerMoney(playerid) < 3000)
  370. {
  371. SendClientMessage(playerid, -1, "You don't have enough money");
  372. return 1;
  373. }
  374. HouseInfo[i][hFridge] = 1;
  375. GivePlayerMoney(playerid, -3000);
  376. SendClientMessage(playerid, -1, "You have a fridge now");
  377. }
  378. case 2:
  379. {
  380. if(HouseInfo[i][hIntType] == 1)
  381. {
  382. HouseInfo[i][hExitX] = 223.0732;
  383. HouseInfo[i][hExitY] = 1288.3668;
  384. HouseInfo[i][hExitZ] = 1082.1406;
  385. HouseInfo[i][hInt] = 1;
  386. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  387. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  388. SaveHouse(i);
  389. SendClientMessage(playerid,-1, "You changed interior to standard small house interior");
  390. }
  391. else if(HouseInfo[i][hIntType] == 2)
  392. {
  393. HouseInfo[i][hExitX] = 2365.2822;
  394. HouseInfo[i][hExitY] = -1134.5186;
  395. HouseInfo[i][hExitZ] = 1050.8750;
  396. HouseInfo[i][hInt] = 8;
  397. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  398. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  399. SaveHouse(i);
  400. SendClientMessage(playerid, -1, "You cnaged interior to standard medium house interior");
  401. }
  402. else if(HouseInfo[i][hIntType] == 3)
  403. {
  404. HouseInfo[i][hExitX] = 2317.8977;
  405. HouseInfo[i][hExitY] = -1025.7722;
  406. HouseInfo[i][hExitZ] = 1050.2109;
  407. HouseInfo[i][hInt] = 9;
  408. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  409. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  410. SaveHouse(i);
  411. SendClientMessage(playerid,-1, "You changed interior to standard big house interior");
  412. }
  413. else if(HouseInfo[i][hIntType] == 4)
  414. {
  415. HouseInfo[i][hExitX] = 140.2605;
  416. HouseInfo[i][hExitY] = 1367.4221;
  417. HouseInfo[i][hExitZ] = 1083.8615;
  418. HouseInfo[i][hInt] = 5;
  419. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  420. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  421. SaveHouse(i);
  422. SendClientMessage(playerid, -1, "You changed interior to standard villa interior");
  423.  
  424. }
  425. }
  426. case 3:
  427. {
  428. if(GetPlayerMoney(playerid) < 30000)
  429. {
  430. SendClientMessage(playerid, -1, "You don't have enough money");
  431. return 1;
  432. }
  433. GivePlayerMoney(playerid, -30000);
  434. if(HouseInfo[i][hIntType] == 1)
  435. {
  436. HouseInfo[i][hExitX] = 2308.7527;
  437. HouseInfo[i][hExitY] = -1211.7507;
  438. HouseInfo[i][hExitZ] = 1049.0234;
  439. HouseInfo[i][hInt] = 6;
  440. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  441. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  442. SaveHouse(i);
  443. SendClientMessage(playerid, -1, "You succesfully changed small house interior");
  444. }
  445. else if(HouseInfo[i][hIntType] == 2)
  446. {
  447. HouseInfo[i][hExitX] = 2195.9036;
  448. HouseInfo[i][hExitY] = -1204.4109;
  449. HouseInfo[i][hExitZ] = 1049.0234;
  450. HouseInfo[i][hInt] = 6;
  451. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  452. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  453. SaveHouse(i);
  454. SendClientMessage(playerid, -1, "You succesfully changed medium house interior");
  455. }
  456. else if(HouseInfo[i][hIntType] == 3)
  457. {
  458. HouseInfo[i][hExitX] = 83.1142;
  459. HouseInfo[i][hExitY] = 1323.1691;
  460. HouseInfo[i][hExitZ] = 1083.8594;
  461. HouseInfo[i][hInt] = 9;
  462. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  463. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  464. SaveHouse(i);
  465. SendClientMessage(playerid, -1, "You succesfully changed big house interior");
  466. }
  467. else if(HouseInfo[i][hIntType] == 4)
  468. {
  469. HouseInfo[i][hExitX] = 226.9117;
  470. HouseInfo[i][hExitY] = 1114.2726;
  471. HouseInfo[i][hExitZ] = 1080.9961;
  472. HouseInfo[i][hInt] = 5;
  473. SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0);
  474. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  475. SaveHouse(i);
  476. SendClientMessage(playerid, -1, "You succesfully changed villa interior");
  477.  
  478. }
  479. }
  480. case 4:
  481. {
  482. if(GetPlayerMoney(playerid) < 40000)
  483. {
  484. SendClientMessage(playerid,-1, "You don't have enough money");
  485. return 1;
  486. }
  487. GivePlayerMoney(playerid, -40000);
  488. if(HouseInfo[i][hIntType] == 1)
  489. {
  490. HouseInfo[i][hExitX] = 261.0457;
  491. HouseInfo[i][hExitY] = 1285.4824;
  492. HouseInfo[i][hExitZ] = 1080.2578;
  493. HouseInfo[i][hInt] = 4;
  494. SetPlayerInterior(playerid, 0);
  495. SetPlayerVirtualWorld(playerid, 0);
  496. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  497. SaveHouse(i);
  498. SendClientMessage(playerid,-1, "You succesfully changed small house interior");
  499. }
  500. else if(HouseInfo[i][hIntType] == 2)
  501. {
  502. HouseInfo[i][hExitX] = 2269.3962;
  503. HouseInfo[i][hExitY] = -1210.4148;
  504. HouseInfo[i][hExitZ] = 1047.5625;
  505. HouseInfo[i][hInt] = 10;
  506. SetPlayerInterior(playerid, 0);
  507. SetPlayerVirtualWorld(playerid, 0);
  508. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  509. SaveHouse(i);
  510. SendClientMessage(playerid, -1, "You succesfully changed medium house interior");
  511. }
  512. else if(HouseInfo[i][hIntType] == 3)
  513. {
  514. HouseInfo[i][hExitX] = 2324.4817;
  515. HouseInfo[i][hExitY] = -1148.3988;
  516. HouseInfo[i][hExitZ] = 1050.7101;
  517. HouseInfo[i][hInt] = 12;
  518. SetPlayerInterior(playerid, 0);
  519. SetPlayerVirtualWorld(playerid, 0);
  520. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  521. SaveHouse(i);
  522. SendClientMessage(playerid, -1, "You succesfully changed big house interior");
  523. }
  524. else if(HouseInfo[i][hIntType] == 4)
  525. {
  526. HouseInfo[i][hExitX] = 225.9810;
  527. HouseInfo[i][hExitY] = 1022.8190;
  528. HouseInfo[i][hExitZ] = 1084.0137;
  529. HouseInfo[i][hInt] = 7;
  530. SetPlayerInterior(playerid, 0);
  531. SetPlayerVirtualWorld(playerid, 0);
  532. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  533. SaveHouse(i);
  534. SendClientMessage(playerid, -1, "You succesfully changed villa interior");
  535. }
  536. }
  537. }
  538. }
  539. }
  540. ////////////////////////////////////////////////////////////////////////////////////
  541. if(dialogid == DIALOG_HRENT)
  542. {
  543. if(!response)
  544. {
  545. return 1;
  546. }
  547. if(response)
  548. {
  549. new i = PlayerInfo[playerid][pHouseOwner];
  550. new price1 = (HouseInfo[i][hPrice] / 4) * 2;
  551. GivePlayerMoney(playerid, price1);
  552. HouseInfo[i][hIsOwned] = 0;
  553. HouseInfo[i][hMoney] = 0;
  554. HouseInfo[i][hWeapons] = -1;
  555. HouseInfo[i][hAmmo] = 0;
  556. HouseInfo[i][hSkin] = 0;
  557. HouseInfo[i][hDrugs] = 0;
  558. HouseInfo[i][hLocked] = 1;
  559. HouseInfo[i][hRent] = 0;
  560. HouseInfo[i][hFood] = 0;
  561. strmid(HouseInfo[i][hOwner], "Niko", 0, strlen("Niko"), 255);
  562. PlayerInfo[playerid][pHouseOwner] = -1;
  563. SaveHouse(i);
  564. HouseLP(i);
  565. new string[40];
  566. format(string, sizeof(string), "You sold your house for %d$", price1);
  567. }
  568. }
  569. ////////////////////////////////////////////////////////////////////////////////////
  570. if(dialogid == DIALOG_HTAKE)
  571. {
  572. if(!response)
  573. {
  574. return 1;
  575. }
  576. if(response)
  577. {
  578. new i = PlayerInfo[playerid][pHouseOwner];
  579. switch(listitem)
  580. {
  581. case 0:
  582. {
  583. ShowPlayerDialog(playerid, DIALOG_HTMONEY, DIALOG_STYLE_INPUT, ""HGREEN"Take money", ""WHITE"Please put in money that you want to take from your home", "Take", "Exit");
  584. }
  585. case 1:
  586. {
  587. ShowPlayerDialog(playerid, DIALOG_HTDRUGS, DIALOG_STYLE_INPUT, ""HGREEN"Take drugs", ""WHITE"Please put in drugs that you want to take from your home", "Take", "Exit");
  588. }
  589. case 2:
  590. {
  591. if(HouseInfo[i][hSkin] == 0)
  592. {
  593. SendClientMessage(playerid, -1, "You don't have any skin in your house");
  594. return 1;
  595. }
  596. SetPlayerSkin(playerid, HouseInfo[i][hSkin]);
  597. HouseInfo[i][hSkin] = 0;
  598. SendClientMessage(playerid, -1, "You took skin from your house");
  599. SaveHouse(i);
  600. }
  601. case 3:
  602. {
  603. if(HouseInfo[i][hWeapons] == -1)
  604. {
  605. SendClientMessage(playerid, -1, "You don't have any weapons in your house");
  606. return 1;
  607. }
  608. GivePlayerWeapon(playerid, HouseInfo[i][hWeapons], HouseInfo[i][hAmmo]);
  609. HouseInfo[i][hWeapons] = -1;
  610. HouseInfo[i][hAmmo] = -1;
  611. SaveHouse(i);
  612. SendClientMessage(playerid, -1, "You took weapons from your house");
  613. }
  614. }
  615. }
  616. }
  617. if(dialogid == DIALOG_HTDRUGS)
  618. {
  619. if(!response)
  620. {
  621. return 1;
  622. }
  623. if(response)
  624. {
  625. new i = PlayerInfo[playerid][pHouseOwner];
  626. new drugs;
  627. if(sscanf(inputtext, "i", drugs))
  628. {
  629. ShowPlayerDialog(playerid, DIALOG_HTDRUGS, DIALOG_STYLE_INPUT, ""HGREEN"Take drugs", ""WHITE"Please put in drugs that you want to take from your home", "Take", "Exit");
  630. return 1;
  631. }
  632. if(drugs > HouseInfo[i][hDrugs])
  633. {
  634. SendClientMessage(playerid, -1, "You don't have that much drug in your house");
  635. return 1;
  636. }
  637. if(drugs < 1 || drugs > 50000)
  638. {
  639. SendClientMessage(playerid, -1, "You can't take less than 1 or more that 50000");
  640. return 1;
  641. }
  642. HouseInfo[i][hDrugs] -= drugs;
  643. PlayerInfo[playerid][pDrugs] += drugs;
  644. SaveHouse(i);
  645. new string1[55];
  646. format(string1, sizeof(string1), "You took %dg drugs", drugs);
  647. SendClientMessage(playerid, -1, string1);
  648. }
  649. }
  650. if(dialogid == DIALOG_HTMONEY)
  651. {
  652. if(!response)
  653. {
  654. return 1;
  655. }
  656. if(response)
  657. {
  658. new i = PlayerInfo[playerid][pHouseOwner];
  659. new money;
  660. if(sscanf(inputtext, "i", money))
  661. {
  662. ShowPlayerDialog(playerid, DIALOG_HTMONEY, DIALOG_STYLE_INPUT, ""HGREEN"Take money", ""WHITE"Please put in money that you want to take from your home", "Take", "Exit");
  663. return 1;
  664. }
  665. if(money > HouseInfo[i][hMoney])
  666. {
  667. SendClientMessage(playerid, -1, "You don;t have that much money in your house");
  668. return 1;
  669. }
  670. HouseInfo[i][hMoney] -= money;
  671. GivePlayerMoney(playerid, money);
  672. SaveHouse(i);
  673. new string[55];
  674. format(string, sizeof(string), "You took %d$ from house", money);
  675. SendClientMessage(playerid, -1, string);
  676. }
  677. }
  678. if(dialogid == DIALOG_HPUT)
  679. {
  680. if(!response)
  681. {
  682. return 1;
  683. }
  684. if(response)
  685. {
  686. new i = PlayerInfo[playerid][pHouseOwner];
  687. switch(listitem)
  688. {
  689. case 0:
  690. {
  691. ShowPlayerDialog(playerid, DIALOG_HPMONEY, DIALOG_STYLE_INPUT, ""HGREEN"Put money", ""WHITE"Put in how much money you want to leave in your house", "Put", "Exit");
  692. }
  693. case 1:
  694. {
  695. ShowPlayerDialog(playerid, DIALOG_HPDRUGS, DIALOG_STYLE_INPUT, ""HGREEN"Put drugs", ""WHITE"Put in how much drugs you want to leave in your house", "Put", "Exit");
  696. }
  697. case 2:
  698. {
  699. if(HouseInfo[i][hSkin] != 0)
  700. {
  701. SendClientMessage(playerid, -1, "You allreade have skin in your house");
  702. return 1;
  703. }
  704. HouseInfo[i][hSkin] = GetPlayerSkin(playerid);
  705. SaveHouse(i);
  706. SendClientMessage(playerid, -1, "You've put your skin in house");
  707. }
  708. case 4:
  709. {
  710. if(HouseInfo[i][hWeapons] != -1)
  711. {
  712. SendClientMessage(playerid, -1, "You allready have weapons in your house");
  713. return 1;
  714. }
  715. if(GetPlayerWeapon(playerid) <= 0)
  716. {
  717. SendClientMessage(playerid, -1, "You don't have any weapons in your hand");
  718. return 1;
  719. }
  720. HouseInfo[i][hWeapons] = GetPlayerWeapon(playerid);
  721. HouseInfo[i][hAmmo] = GetPlayerAmmo(playerid);
  722. SaveHouse(i);
  723. SendClientMessage(playerid, -1, "You've put your weapons in house");
  724. }
  725. }
  726. }
  727. }
  728. if(dialogid == DIALOG_HPDRUGS)
  729. {
  730. if(!response)
  731. {
  732. return 1;
  733. }
  734. if(response)
  735. {
  736. new i = PlayerInfo[playerid][pHouseOwner];
  737. new drugs;
  738. if(sscanf(inputtext, "i", drugs))
  739. {
  740. ShowPlayerDialog(playerid, DIALOG_HPDRUGS, DIALOG_STYLE_INPUT, ""HGREEN"Put drugs", ""WHITE"Put in how much drugs you want to leave in your house", "Put", "Exit");
  741. return 1;
  742. }
  743. if(drugs > PlayerInfo[playerid][pDrugs])
  744. {
  745. SendClientMessage(playerid, -1, "You don't have that much drugs");
  746. return 1;
  747. }
  748. HouseInfo[i][hDrugs] += drugs;
  749. PlayerInfo[playerid][pDrugs] -= drugs;
  750. SaveHouse(i);
  751. new string[55];
  752. format(string, sizeof(string), "You've put %dg drugs in house", drugs);
  753. SendClientMessage(playerid, -1, string);
  754. }
  755. }
  756. if(dialogid == DIALOG_HPMONEY)
  757. {
  758. if(!response)
  759. {
  760. return 1;
  761. }
  762. if(response)
  763. {
  764. new i = PlayerInfo[playerid][pHouseOwner];
  765. new money;
  766. if(sscanf(inputtext, "i", money))
  767. {
  768. ShowPlayerDialog(playerid, DIALOG_HPMONEY, DIALOG_STYLE_INPUT, ""HGREEN"Put money", ""WHITE"Put in how much money you want to leave in your house", "Put", "Exit");
  769. return 1;
  770. }
  771. if(money > GetPlayerMoney(playerid))
  772. {
  773. SendClientMessage(playerid, -1, "You don't have that much money");
  774. return 1;
  775. }
  776. HouseInfo[i][hMoney] += money;
  777. GivePlayerMoney(playerid, -money);
  778. SaveHouse(i);
  779. new string[55];
  780. format(string, sizeof(string), "You've put %d$ in your house", money);
  781. SendClientMessage(playerid, -1, string);
  782. }
  783. }
  784. return 1;
  785. }
  786.  
  787. CMD:createhouse(playerid, params[])
  788. {
  789. if(!IsPlayerAdmin(playerid))
  790. {
  791. SendClientMessage(playerid, -1, "You are not allowed to use this command");
  792. return 1;
  793. }
  794. new idhouse, type, level, price, hFile[80], string[500], Float:X, Float:Y, Float:Z;
  795. GetPlayerPos(playerid, X, Y, Z);
  796. if(sscanf(params, "iiii", idhouse, type, level, price))
  797. {
  798. SendClientMessage(playerid, -1, "/createhouse [ID] [Type] [Level] [Price]");
  799. SendClientMessage(playerid, -1, "Types: 0: Small | 1: Medium | 2: Big | 3: Villa");
  800. }
  801. if(idhouse >= MAX_HOUSES)
  802. {
  803. SendClientMessage(playerid, -1, "You've allready reched max houses limit");
  804. return 1;
  805. }
  806. format(hFile, sizeof(hFile), HOUSE_FILE, idhouse);
  807. if(fexist(hFile))
  808. {
  809. SendClientMessage(playerid, -1, "That house ID is allready occupied");
  810. return 1;
  811. }
  812. if(type == 0) // SMALL
  813. {
  814. HouseInfo[idhouse][hExitX] = 223.0732;
  815. HouseInfo[idhouse][hExitY] = 1288.3668;
  816. HouseInfo[idhouse][hExitZ] = 1082.1406;
  817. HouseInfo[idhouse][hInt] = 1;
  818. strmid(HouseInfo[idhouse][hType],"Mala Kuca",0,strlen("Mala Kuca"),255);
  819. HouseInfo[idhouse][hIntType] = 1;
  820. }
  821. else if(type == 1) // MEDIUM
  822. {
  823. HouseInfo[idhouse][hExitX] = 2365.2822;
  824. HouseInfo[idhouse][hExitY] = -1134.5186;
  825. HouseInfo[idhouse][hExitZ] = 1050.8750;
  826. HouseInfo[idhouse][hInt] = 8;
  827. strmid(HouseInfo[idhouse][hType],"Srednja Kuca",0,strlen("Srednja Kuca"),255);
  828. HouseInfo[idhouse][hIntType] = 2;
  829. }
  830. else if(type == 2) // BIG
  831. {
  832. HouseInfo[idhouse][hExitX] = 2317.8977;
  833. HouseInfo[idhouse][hExitY] = -1025.7722;
  834. HouseInfo[idhouse][hExitZ] = 1050.2109;
  835. HouseInfo[idhouse][hInt] = 9;
  836. strmid(HouseInfo[idhouse][hType],"Velika Kuca",0,strlen("Velika Kuca"),255);
  837. HouseInfo[idhouse][hIntType] = 3;
  838. }
  839. else if(type == 3) // VILLA
  840. {
  841. HouseInfo[idhouse][hExitX] = 140.2605;
  842. HouseInfo[idhouse][hExitY] = 1367.4221;
  843. HouseInfo[idhouse][hExitZ] = 1083.8615;
  844. HouseInfo[idhouse][hInt] = 5;
  845. strmid(HouseInfo[idhouse][hType],"Villa",0,strlen("Villa"),255);
  846. HouseInfo[idhouse][hIntType] = 4;
  847. }
  848. HouseInfo[idhouse][hPrice] = price;
  849. HouseInfo[idhouse][hLevel] = level;
  850. HouseInfo[idhouse][hEnterX] = X;
  851. HouseInfo[idhouse][hEnterY] = Y;
  852. HouseInfo[idhouse][hEnterZ] = Z;
  853. HouseInfo[idhouse][hFood] = 0;
  854. HouseInfo[idhouse][hIsOwned] = 0;
  855. HouseInfo[idhouse][hFridge] = 0;
  856. HouseInfo[idhouse][hMoney] = 0;
  857. HouseInfo[idhouse][hLocked] = 1;
  858. HouseInfo[idhouse][hVW] = idhouse;
  859. HouseInfo[idhouse][hBell] = 0;
  860. HouseInfo[idhouse][hWeapons] = -1;
  861. HouseInfo[idhouse][hAmmo] = 0;
  862. HouseInfo[idhouse][hRent] = 0;
  863. HouseInfo[idhouse][hRentPrice] = 50;
  864. HouseInfo[idhouse][hDrugs] = 0;
  865. HouseInfo[idhouse][hSkin] = 0;
  866. strmid(HouseInfo[idhouse][hOwner], "Noone", 0, strlen("Noone"), 255);
  867. format(string, sizeof(string), ""HGREEN"House on Sale!\nType: "WHITE"%s\n"HGREEN"Price: "WHITE"%d$\n"HGREEN"Level: "WHITE"%d\n"HGREEN"To buy house type /buyhouse",HouseInfo[idhouse][hType], HouseInfo[idhouse][hPrice], HouseInfo[idhouse][hLevel]);
  868. HouseLabel[idhouse] = Create3DTextLabel(string, 0x33CCFFAA, X, Y, Z, 25, 0, 1);
  869. HousePickup[idhouse] = CreateDynamicPickup(1273, 1, HouseInfo[idhouse][hEnterX], HouseInfo[idhouse][hEnterY], HouseInfo[idhouse][hEnterZ]);
  870. SaveHouse(idhouse);
  871. format(string, sizeof(string), "You succesfully created house (ID: %d)", idhouse);
  872. return 1;
  873. }
  874.  
  875. CMD:buyhouse(playerid, params[])
  876. {
  877. for(new h; h < sizeof(HouseInfo); h++)
  878. {
  879. if(!strcmp(HouseInfo[h][hOwner], "Noone", true) && HouseInfo[h][hIsOwned] == 0)
  880. {
  881. if(PlayerInfo[playerid][pHouseOwner] != -1)
  882. {
  883. SendClientMessage(playerid, -1, "You can't buy house. You allready have one");
  884. return 1;
  885. }
  886. if(GetPlayerScore(playerid) < HouseInfo[h][hLevel])
  887. {
  888. SendClientMessage(playerid, -1, "You are not big enough level to buy this house");
  889. return 1;
  890. }
  891. if(GetPlayerMoney(playerid) < HouseInfo[h][hPrice])
  892. {
  893. SendClientMessage(playerid, -1, "You don't have enough money");
  894. return 1;
  895. }
  896. if(PlayerInfo[playerid][pRenting] != 1)
  897. {
  898. SendClientMessage(playerid, -1, "You need to unrent current house");
  899. return 1;
  900. }
  901. strmid(HouseInfo[h][hOwner], GetName(playerid), 0, strlen(GetName(playerid)), 255);
  902. HouseInfo[h][hIsOwned] = 1;
  903. SetPlayerInterior(playerid, HouseInfo[h][hInt]);
  904. PlayerInfo[playerid][pHouseOwner] = h;
  905. SetPlayerVirtualWorld(playerid, HouseInfo[h][hVW]);
  906. SetPlayerPos(playerid, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ]);
  907. HouseInfo[h][hLocked] = 1;
  908. GivePlayerMoney(playerid, -HouseInfo[h][hPrice]);
  909. HouseLP(h);
  910. SaveHouse(h);
  911. SendClientMessage(playerid, -1, "You purchased house. Type /house for more info");
  912. return 1;
  913. }
  914. else
  915. {
  916. SendClientMessage(playerid, -1, "That house is not for sale");
  917. return 1;
  918. }
  919. }
  920. return 1;
  921. }
  922.  
  923. CMD:house(playerid, params[])
  924. {
  925. new string1[275], string2[275], string[550];
  926. if(PlayerInfo[playerid][pHouseOwner] == -1)
  927. {
  928. SendClientMessage(playerid, -1, "You are homeless");
  929. return 1;
  930. }
  931. if(strcmp(HouseInfo[PlayerInfo[playerid][pHouseOwner]][hOwner], GetName(playerid), true))
  932. {
  933. SendClientMessage(playerid, -1, "You are not owner of that house");
  934. return 1;
  935. }
  936. format(string1, sizeof(string1), ""HGREEN"(1). "WHITE"Info\n"HGREEN"(2). "WHITE"Unlock\n"HGREEN"(3). "WHITE"Lock\n"HGREEN"(4). "WHITE"Put in house\n"HGREEN"(5). "WHITE"Take from house\n");
  937. format(string2, sizeof(string1), ""HGREEN"(6). "WHITE"Sell house\n"HGREEN"(7). "WHITE"Allow/Forbid rent\n"HGREEN"(8). "WHITE"Rent Price\n"HGREEN"(9). "WHITE"Upgrade - Change");//\n"HGREEN"(10). "WHITE"Take from fridge"); // this one will be upgraded in future versions. Let it be like this for now :)
  938. format(string, sizeof(string), "%s%s", string1, string2);
  939. ShowPlayerDialog(playerid, DIALOG_HOUSE, DIALOG_STYLE_LIST, ""HGREEN"House", string, "Choose", "Leave");
  940. return 1;
  941. }
  942.  
  943. CMD:renthouse(playerid, params[])
  944. {
  945. for(new h = 0; h < MAX_HOUSES; h++)
  946. {
  947. if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]))
  948. {
  949. if(PlayerInfo[playerid][pHouseOwner] != 1)
  950. {
  951. SendClientMessage(playerid, -1, "You can't rent because you owning a house");
  952. return 1;
  953. }
  954. if(HouseInfo[h][hRent] == 0)
  955. {
  956. SendClientMessage(playerid, -1, "You can't rent this house");
  957. return 1;
  958. }
  959. if(GetPlayerMoney(playerid) < HouseInfo[h][hRentPrice])
  960. {
  961. SendClientMessage(playerid, -1, "You don't have enough money");
  962. return 1;
  963. }
  964. new string[50];
  965. GivePlayerMoney(playerid, -HouseInfo[h][hRentPrice]);
  966. HouseInfo[h][hMoney] += HouseInfo[h][hRentPrice];
  967. PlayerInfo[playerid][pRenting] = h;
  968. SetPlayerInterior(playerid, HouseInfo[h][hInt]);
  969. SetPlayerVirtualWorld(playerid, HouseInfo[h][hVW]);
  970. SetPlayerPos(playerid, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ]);
  971. format(string, sizeof(string), "You rented a house for %d$", HouseInfo[h][hRentPrice]);
  972. return 1;
  973. }
  974. }
  975. return 1;
  976. }
  977.  
  978. CMD:ring(playerid, params[])
  979. {
  980. for(new h = 0; h < sizeof(HouseInfo); h++)
  981. {
  982. if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]))
  983. {
  984. if(HouseInfo[h][hBell] == 0)
  985. {
  986. SendClientMessage(playerid, -1, "That house does not have bell");
  987. return 1;
  988. }
  989. SendClientMessage(playerid, -1, "You are ringing");
  990. foreach(Player, i)
  991. {
  992. if(IsPlayerInRangeOfPoint(i, 30.0, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ]))
  993. {
  994. SendClientMessage(playerid, i, "Someone is ringing on your doors");
  995. }
  996. }
  997. }
  998. }
  999. return 1;
  1000. }
  1001.  
  1002. CMD:unrenthouse(playerid, params[])
  1003. {
  1004. if(PlayerInfo[playerid][pHouseOwner] != 1)
  1005. {
  1006. SendClientMessage(playerid, -1, "You can't do that. You are a house owner");
  1007. return 1;
  1008. }
  1009. if(PlayerInfo[playerid][pRenting] == -1)
  1010. {
  1011. SendClientMessage(playerid, -1, "You are not renting any house");
  1012. return 1;
  1013. }
  1014. PlayerInfo[playerid][pRenting] = -1;
  1015. SendClientMessage(playerid, -1, "You unrented the house. You are homeless now");
  1016. return 1;
  1017. }
  1018.  
  1019. CMD:ehouse(playerid, params[])
  1020. {
  1021. if(!IsPlayerAdmin(playerid))
  1022. {
  1023. SendClientMessage(playerid, -1, "You are not authorised to use this command");
  1024. return 1;
  1025. }
  1026. new what[35], string[100], quantity; //i think i spelled this right xD
  1027. if(sscanf(params, "s[35]i", what, quantity)) //this also
  1028. {
  1029. SendClientMessage(playerid, -1, "/ehouse [level, price, money] [quantity]"); // this too :D
  1030. return 1;
  1031. }
  1032. for(new h; h < MAX_HOUSES; h++)
  1033. {
  1034. if(IsPlayerInRangeOfPoint(playerid, 3.0, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]))
  1035. {
  1036. if(!strcmp(what, "level", true))
  1037. {
  1038. HouseInfo[h][hLevel] = quantity; //what is happening with me??
  1039. HouseLP(h);
  1040. SaveHouse(h);
  1041. format(string, sizeof(string), "You changed house's level (ID: %d) to %d!", h, HouseInfo[h][hLevel]);
  1042. SendClientMessage(playerid, -1, string);
  1043. }
  1044. else if(!strcmp(what, "price", true))
  1045. {
  1046. HouseInfo[h][hPrice] = quantity; // WHOOOAAA this is very strange!!
  1047. HouseLP(h);
  1048. SaveHouse(h);
  1049. format(string, sizeof(string), "You changed house's price (ID: %d) to %d!", h, HouseInfo[h][hPrice]);
  1050. SendClientMessage(playerid, -1, string);
  1051. }
  1052. else if(!strcmp(what, "novac", true))
  1053. {
  1054. HouseInfo[h][hMoney] = quantity; //Okay this is to much for me to handle. I am out
  1055. HouseLP(h); //Just kidding im back
  1056. SaveHouse(h);
  1057. format(string, sizeof(string), "You changed house's money (ID: %d) to %d!", h, HouseInfo[h][hMoney]);
  1058. }
  1059. }
  1060. }
  1061. return 1;
  1062. }
  1063. //===================== [ This is for loading houses ] =========================//
  1064. forward LoadHouses(idhouse, name[], value[]);
  1065. public LoadHouses(idhouse, name[], value[])
  1066. {
  1067. INI_Int("IsOwned", HouseInfo[idhouse][hIsOwned]);
  1068. INI_String("Owner", HouseInfo[idhouse][hOwner],45);
  1069. INI_String("Type", HouseInfo[idhouse][hType],35);
  1070. INI_Float("EnterX", HouseInfo[idhouse][hEnterX]);
  1071. INI_Float("EnterY", HouseInfo[idhouse][hEnterY]);
  1072. INI_Float("EnterZ", HouseInfo[idhouse][hEnterZ]);
  1073. INI_Float("ExitX", HouseInfo[idhouse][hExitX]);
  1074. INI_Float("ExitY", HouseInfo[idhouse][hExitY]);
  1075. INI_Float("ExitZ", HouseInfo[idhouse][hExitZ]);
  1076. INI_Int("Level", HouseInfo[idhouse][hLevel]);
  1077. INI_Int("Price", HouseInfo[idhouse][hPrice]);
  1078. INI_Int("Money", HouseInfo[idhouse][hMoney]);
  1079. INI_Int("Interior", HouseInfo[idhouse][hInt]);
  1080. INI_Int("Locked", HouseInfo[idhouse][hLocked]);
  1081. INI_Int("VW", HouseInfo[idhouse][hVW]);
  1082. INI_Int("Weapons", HouseInfo[idhouse][hWeapons]);
  1083. INI_Int("Ammo", HouseInfo[idhouse][hAmmo]);
  1084. INI_Int("Rent", HouseInfo[idhouse][hRent]);
  1085. INI_Int("RentPrice", HouseInfo[idhouse][hRentPrice]);
  1086. INI_Int("Bell", HouseInfo[idhouse][hBell]);
  1087. INI_Int("Fridge", HouseInfo[idhouse][hFridge]);
  1088. INI_Int("Drugs", HouseInfo[idhouse][hDrugs]);
  1089. INI_Int("Skins", HouseInfo[idhouse][hSkin]);
  1090. INI_Int("IntType", HouseInfo[idhouse][hIntType]);
  1091. INI_Int("Food", HouseInfo[idhouse][hFood]);
  1092. return 1;
  1093. }
  1094. //===================== [ This is for saving houses ] ==========================// //when i say saving i don't mean about saving it from fire. Don't worry it won't get burned :D Or is it?? o.O
  1095. stock SaveHouse(idhouse)
  1096. {
  1097. new hFile[128];
  1098. format(hFile, sizeof(hFile), HOUSE_FILE, idhouse);
  1099. new INI:File = INI_Open(hFile);
  1100. INI_WriteInt(File, "Is Owned", HouseInfo[idhouse][hIsOwned]);
  1101. INI_WriteString(File, "Owner", HouseInfo[idhouse][hOwner]);
  1102. INI_WriteString(File, "Type", HouseInfo[idhouse][hType]);
  1103. INI_WriteFloat(File, "EnterX", HouseInfo[idhouse][hEnterX]);
  1104. INI_WriteFloat(File, "EnterY", HouseInfo[idhouse][hEnterY]);
  1105. INI_WriteFloat(File, "EnterZ", HouseInfo[idhouse][hEnterZ]);
  1106. INI_WriteFloat(File, "ExitX", HouseInfo[idhouse][hExitX]);
  1107. INI_WriteFloat(File, "ExitY", HouseInfo[idhouse][hExitY]);
  1108. INI_WriteFloat(File, "ExitZ", HouseInfo[idhouse][hExitZ]);
  1109. INI_WriteInt(File, "Level", HouseInfo[idhouse][hLevel]);
  1110. INI_WriteInt(File, "Price", HouseInfo[idhouse][hPrice]); //price of house
  1111. INI_WriteInt(File, "Money", HouseInfo[idhouse][hMoney]); //money that is saved in house
  1112. INI_WriteInt(File, "Interior", HouseInfo[idhouse][hInt]);
  1113. INI_WriteInt(File, "Locked", HouseInfo[idhouse][hLocked]);
  1114. INI_WriteInt(File, "VW", HouseInfo[idhouse][hVW]);
  1115. INI_WriteInt(File, "Weapons", HouseInfo[idhouse][hWeapons]);
  1116. INI_WriteInt(File, "Ammo", HouseInfo[idhouse][hAmmo]);
  1117. INI_WriteInt(File, "Rent", HouseInfo[idhouse][hRent]); //is rent allowed
  1118. INI_WriteInt(File, "RentPrice", HouseInfo[idhouse][hRentPrice]); // price of rent
  1119. INI_WriteInt(File, "Bell", HouseInfo[idhouse][hBell]);
  1120. INI_WriteInt(File, "Fridge", HouseInfo[idhouse][hFridge]);
  1121. INI_WriteInt(File, "Drugs", HouseInfo[idhouse][hDrugs]);
  1122. INI_WriteInt(File, "Skin", HouseInfo[idhouse][hSkin]);
  1123. INI_WriteInt(File, "IntType", HouseInfo[idhouse][hIntType]);
  1124. INI_WriteInt(File, "Food", HouseInfo[idhouse][hFood]);
  1125. INI_Close(File);
  1126. return 1;
  1127. }
  1128.  
  1129. stock HouseLP(h)
  1130. {
  1131. new string[500];
  1132. if(HouseInfo[h][hIsOwned] == 0)
  1133. {
  1134. Delete3DTextLabel(HouseLabel[h]);
  1135. DestroyDynamicPickup(HousePickup[h]);
  1136. format(string, sizeof(string), ""HGREEN"House on Sale!\nType: "WHITE"%s\n"HGREEN"Price: "WHITE"%d$\n"HGREEN"Level: "WHITE"%d\n"HGREEN"To buy house type /buyhouse",HouseInfo[h][hType], HouseInfo[h][hPrice], HouseInfo[h][hLevel]);
  1137. HouseLabel[h] = Create3DTextLabel(string, 0x33CCFFAA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 30.0, 0, 1);
  1138. HousePickup[h] = CreateDynamicPickup(1237, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
  1139. }
  1140. else if(HouseInfo[h][hIsOwned] == 1)
  1141. {
  1142. Delete3DTextLabel(HouseLabel[h]);
  1143. DestroyDynamicPickup(HousePickup[h]);
  1144. if(HouseInfo[h][hRent] == 0)
  1145. {
  1146. format(string, sizeof(string), ""HGREEN"Owner: "WHITE"%s\n"HGREEN"Type: "WHITE"%s\n"HGREEN"Level: "WHITE"%d\n"HGREEN"Price: "WHITE"%d$\n", HouseInfo[h][hOwner], HouseInfo[h][hType], HouseInfo[h][hLevel], HouseInfo[h][hPrice]);
  1147. }
  1148. else if(HouseInfo[h][hRent] == 1)
  1149. {
  1150. format(string, sizeof(string), ""HGREEN"Owner: "WHITE"%s\n"HGREEN"Type: "WHITE"%s\n"HGREEN"Level: "WHITE"%d\n"HGREEN"Price: "WHITE"%d$\n"HGREEN"Rent Price: "WHITE"%d$\n"HGREEN"To rent house type /renthouse", HouseInfo[h][hOwner], HouseInfo[h][hType], HouseInfo[h][hLevel], HouseInfo[h][hPrice]);
  1151. }
  1152. HouseLabel[h] = Create3DTextLabel(string, 0x33CCFFAA, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ], 30.0, 0, 1);
  1153. HousePickup[h] = CreateDynamicPickup(1239, 1, HouseInfo[h][hEnterX], HouseInfo[h][hEnterY], HouseInfo[h][hEnterZ]);
  1154. }
  1155. return 1;
  1156. }
  1157.  
  1158. stock GetName(playerid)
  1159. {
  1160. new name[MAX_PLAYER_NAME];
  1161. GetPlayerName(playerid, name, sizeof(name));
  1162. return name;
  1163. }
Add Comment
Please, Sign In to add comment