Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.35 KB | None | 0 0
  1. //SpawnChange
  2. if(strcmp(cmd, "/spawnchange", true) == 0)
  3. {
  4. if(IsPlayerConnected(playerid))
  5. {
  6. if(PlayerInfo[playerid][pPhousekey] != 255)
  7. {
  8. if(Spectate[playerid] != 255 && PlayerInfo[playerid][pAdmin] < 1)
  9. {
  10. SendClientMessage(playerid, COLOR_GREY, "Nu-ti poti schimba spawnul, esti spectator!");
  11. return 1;
  12. }
  13. if(SpawnChange[playerid])
  14. {
  15. SendClientMessage(playerid, COLOR_GREY, "Acum te vei spawna in locul normal!");
  16. SpawnChange[playerid] = 0;
  17. if(IsAnInstructor(playerid) && PlayerInfo[playerid][pPhousekey] != 255)
  18. {
  19. if(SchoolSpawn[playerid] == 1)
  20. {
  21. SchoolSpawn[playerid] = 0;
  22. SendClientMessage(playerid, COLOR_GREY, "Noul tau spawn este la scoala de soferi (HQ School Instructor)!");
  23. }
  24. }
  25. }
  26. else
  27. {
  28. SendClientMessage(playerid, COLOR_GREY, "Acum te vei spawna la casa/chiria ta!");
  29. SpawnChange[playerid] = 1;
  30. }
  31. }
  32. else
  33. {
  34. if(IsAnInstructor(playerid) && PlayerInfo[playerid][pPhousekey] != 255)
  35. {
  36. if(SchoolSpawn[playerid] == 1)
  37. {
  38. SchoolSpawn[playerid] = 0;
  39. SendClientMessage(playerid, COLOR_GREY, "Noul tau spawn este la scoala de soferi (HQ School Instructor)!");
  40. }
  41. }
  42. else
  43. {
  44. SendClientMessage(playerid, COLOR_GREY, "Nu detii o casa/nu ai chirie!");
  45. return 1;
  46. }
  47. }
  48. }
  49. return 1;
  50. }
  51. //Sistemul de case
  52. #include <a_samp>
  53. #include <zcmd>
  54. #include <sscanf2>
  55. #include <Dini>
  56.  
  57. //------------------------------------------------------------------------------
  58.  
  59. #define MAX_HOUSES 1000
  60.  
  61. //------------------------------------------------------------------------------
  62.  
  63. #define DIALOG_EDITID 300
  64. #define DIALOG_EDIT 301
  65. #define DIALOG_EDITPRICE 302
  66. #define DIALOG_EDITINTERIOR 303
  67. #define DIALOG_CMDS 304
  68.  
  69. //------------------------------------------------------------------------------
  70.  
  71. enum hInfo
  72. {
  73. hPrice,
  74. hInterior,
  75. hOwned,
  76. hLocked,
  77. hPick,
  78. Text3D:hLabel,
  79. hOwner[MAX_PLAYER_NAME],
  80. Float:hX,
  81. Float:hY,
  82. Float:hZ,
  83. Float:hEnterX,
  84. Float:hEnterY,
  85. Float:hEnterZ
  86. }
  87.  
  88. //------------------------------------------------------------------------------
  89.  
  90. new HouseInfo[MAX_HOUSES][hInfo];
  91. new houseid;
  92. new InHouse[MAX_PLAYERS][MAX_HOUSES];
  93. new hid;
  94.  
  95. //------------------------------------------------------------------------------
  96.  
  97. CMD:createhouse(playerid, params[])
  98. {
  99. new Price, Level, string[144], Float:X, Float:Y, Float:Z, labelstring[144], file[50];
  100. GetPlayerPos(playerid, X, Y, Z);
  101. if(sscanf(params, "ii", Price, Level)) return SendClientMessage(playerid, -1, "{FF0000}USAGE: {FFFFFF}/CreateHouse [Price] [Level]");
  102. if(Price > 1000000 || Price < 1) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}Invalid Price. [1 - 10,000,000]");
  103. if(Level > 5 || Level < 1) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}Invalid Level. [1 - 5]");
  104. if(Level == 1)
  105. {
  106. HouseInfo[houseid][hEnterX] = 2237.590087;
  107. HouseInfo[houseid][hEnterY] = -1078.869995;
  108. HouseInfo[houseid][hEnterZ] = 1049.023437;
  109. HouseInfo[houseid][hInterior] = 2;
  110. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}House Interior setted. {FF0000}#1.");
  111. }
  112. else if(Level == 2)
  113. {
  114. HouseInfo[houseid][hEnterX] = 2282.909912;
  115. HouseInfo[houseid][hEnterY] = -1137.971191;
  116. HouseInfo[houseid][hEnterZ] = 1050.898437;
  117. HouseInfo[houseid][hInterior] = 1;
  118. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}House Interior setted. {FF0000}#2.");
  119. }
  120. else if(Level == 3)
  121. {
  122. HouseInfo[houseid][hEnterX] = 2282.909912;
  123. HouseInfo[houseid][hEnterY] = -1137.971191;
  124. HouseInfo[houseid][hEnterZ] = 1050.898437;
  125. HouseInfo[houseid][hInterior] = 11;
  126. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}House Interior setted. {FF0000}#3.");
  127. }
  128. else if(Level == 4)
  129. {
  130. HouseInfo[houseid][hEnterX] = 2365.300048;
  131. HouseInfo[houseid][hEnterY] = -1132.920043;
  132. HouseInfo[houseid][hEnterZ] = 1050.875000;
  133. HouseInfo[houseid][hInterior] = 8;
  134. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}House Interior setted. {FF0000}#4.");
  135. }
  136. else if(Level == 5)
  137. {
  138. HouseInfo[houseid][hEnterX] = 1299.079956;
  139. HouseInfo[houseid][hEnterY] = -795.226989;
  140. HouseInfo[houseid][hEnterZ] = 1084.007812;
  141. HouseInfo[houseid][hInterior] = 5;
  142. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}House Interior setted. {FF0000}#5.");
  143. }
  144. format(string, sizeof(string), "{FF0000}[HOUSE]: {FFFFFF}House ID: {FF0000}%d {FFFFFF}created.", houseid);
  145. SendClientMessage(playerid, -1, string);
  146. format(labelstring, sizeof(labelstring), "{15FF00}House ID: {FFFFFF}%d\n{15FF00}Status: {FFFFFF}For Sale\n{15FF00}Price: {FFFFFF}%d", houseid, Price);
  147. HouseInfo[houseid][hOwned] = 0;
  148. HouseInfo[houseid][hX] = X;
  149. HouseInfo[houseid][hZ] = Z;
  150. HouseInfo[houseid][hY] = Y;
  151. HouseInfo[houseid][hPrice] = Price;
  152. HouseInfo[houseid][hPick] = CreatePickup(1273, 1, X, Y, Z, 0);
  153. HouseInfo[houseid][hLabel] = Create3DTextLabel(labelstring, 0xFFFFFFFF, X, Y, Z, 30.0, 0, 0);
  154. format(file, sizeof(file), "Houses/%d.ini", houseid);
  155. if(!fexist(file))
  156. {
  157. dini_Create(file);
  158. dini_IntSet(file, "Price", Price);
  159. dini_IntSet(file, "Interior", HouseInfo[houseid][hInterior]);
  160. dini_IntSet(file, "Level", Level);
  161. dini_IntSet(file, "Owned", 0);
  162. dini_FloatSet(file, "Position X", X);
  163. dini_FloatSet(file, "Position Y", Y);
  164. dini_FloatSet(file, "Position Z", Z);
  165. dini_FloatSet(file, "Enter X", HouseInfo[houseid][hEnterX]);
  166. dini_FloatSet(file, "Enter Y", HouseInfo[houseid][hEnterY]);
  167. dini_FloatSet(file, "Enter Z", HouseInfo[houseid][hEnterZ]);
  168. }
  169. houseid++;
  170. GivePlayerMoney(playerid, 100000);
  171. return 1;
  172. }
  173.  
  174. //------------------------------------------------------------------------------
  175.  
  176. CMD:buyhouse(playerid, params[])
  177. {
  178. new name[MAX_PLAYER_NAME], labelstring[144], string[144], file[50];
  179. GetPlayerName(playerid, name, sizeof(name));
  180. for(new i = 0; i < MAX_HOUSES; i++)
  181. {
  182. if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]))
  183. {
  184. if(HouseInfo[i][hOwned] == 1) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}This house have an Owner.");
  185. if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice]) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You don't have enough money.");
  186. DestroyPickup(HouseInfo[i][hPick]);
  187. format(labelstring, sizeof(labelstring), "{15FF00}House ID: {FFFFFF}%d\n{15FF00}Owner: {FFFFFF}%s\n{15FF00}Price: {FFFFFF}%d", i, name, HouseInfo[i][hPrice]);
  188. HouseInfo[i][hPick] = CreatePickup(1272, 1, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]);
  189. Update3DTextLabelText(HouseInfo[i][hLabel], 0xFFFFFFFF, labelstring);
  190. format(string, sizeof(string), "{FF0000}[HOUSE]: {FFFFFF}You bought house ID: {FF0000}%d {FFFFFF}for {FF0000}$ %d.", i, HouseInfo[i][hPrice]);
  191. SendClientMessage(playerid, -1, string);
  192. HouseInfo[i][hOwned] = 1;
  193. HouseInfo[i][hOwner] = name;
  194. format(file, sizeof(file), "Houses/%d.ini", i);
  195. if(fexist(file))
  196. {
  197. dini_IntSet(file, "Owned", 1);
  198. dini_Set(file, "Owner", name);
  199. }
  200. }
  201. }
  202. return 1;
  203. }
  204.  
  205. //------------------------------------------------------------------------------
  206.  
  207. CMD:sellhouse(playerid, params[])
  208. {
  209. new pname[MAX_PLAYER_NAME], labelstring[144], string[144], file[50];
  210. GetPlayerName(playerid, pname, sizeof(pname));
  211. for(new i = 0; i < MAX_HOUSES; i++)
  212. {
  213. if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]))
  214. {
  215. if(HouseInfo[i][hOwned] == 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You cannot sell this house.");
  216. if(strcmp(pname, HouseInfo[i][hOwner], true)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You aren't Owner of this house.");
  217. format(labelstring, sizeof(labelstring), "{15FF00}House ID: {FFFFFF}%d\n{15FF00}Status: {FFFFFF}For Sale\n{15FF00}Price: {FFFFFF}%d", i, HouseInfo[i][hPrice]);
  218. DestroyPickup(HouseInfo[i][hPick]);
  219. HouseInfo[i][hPick] = CreatePickup(1273, 1, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ], 0);
  220. Update3DTextLabelText(HouseInfo[i][hLabel], 0xFFFFFFFF, labelstring);
  221. format(string, sizeof(string), "{FF0000}[HOUSE]: {FFFFFF}You've sold your house: {FF0000}%d.", i);
  222. SendClientMessage(playerid, -1, string);
  223. HouseInfo[i][hOwned] = 0;
  224. HouseInfo[i][hOwner] = 0;
  225. format(file, sizeof(file), "Houses/%d.ini", i);
  226. if(fexist(file))
  227. {
  228. dini_IntSet(file, "Owned", 0);
  229. dini_Set(file, "Owner", " ");
  230. }
  231. }
  232. }
  233. return 1;
  234. }
  235.  
  236. //------------------------------------------------------------------------------
  237.  
  238. CMD:enter(playerid, params[])
  239. {
  240. for(new i = 0; i < MAX_HOUSES; i++)
  241. {
  242. if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]))
  243. {
  244. if(HouseInfo[i][hLocked] == 1) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}This house it's locked.");
  245. if(HouseInfo[i][hOwned] == 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You cannot enter in this house.");
  246. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  247. SetPlayerInterior(playerid, HouseInfo[i][hInterior]);
  248. SendClientMessage(playerid, -1, "");
  249. InHouse[playerid][i] = 1;
  250. }
  251. }
  252. return 1;
  253. }
  254.  
  255. //------------------------------------------------------------------------------
  256.  
  257. CMD:exit(playerid, params[])
  258. {
  259. for(new i = 0; i < MAX_HOUSES; i++)
  260. {
  261. if(InHouse[playerid][i] == 1)
  262. {
  263. SetPlayerPos(playerid, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]);
  264. SetPlayerInterior(playerid, 0);
  265. SendClientMessage(playerid, -1, "");
  266. InHouse[playerid][i] = 0;
  267. }
  268. }
  269. return 1;
  270. }
  271.  
  272. //------------------------------------------------------------------------------
  273.  
  274. CMD:lockhouse(playerid, params[])
  275. {
  276. new pname[MAX_PLAYER_NAME];
  277. GetPlayerName(playerid, pname, sizeof(pname));
  278. for(new i = 0; i < MAX_HOUSES; i++)
  279. {
  280. if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]))
  281. {
  282. if(HouseInfo[i][hOwned] == 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You can't lock this house.");
  283. if(HouseInfo[i][hLocked] == 1) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}This house it's already locked.");
  284. if(strcmp(pname, HouseInfo[i][hOwner], true)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You aren't Owner of this house.");
  285. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}You've locked your house.");
  286. GameTextForPlayer(playerid, "House ~r~Locked", 5000, 3);
  287. HouseInfo[i][hLocked] = 1;
  288. }
  289. }
  290. return 1;
  291. }
  292.  
  293. //------------------------------------------------------------------------------
  294.  
  295. CMD:unlockhouse(playerid, params[])
  296. {
  297. new pname[MAX_PLAYER_NAME];
  298. GetPlayerName(playerid, pname, sizeof(pname));
  299. for(new i = 0; i < MAX_HOUSES; i++)
  300. {
  301. if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]))
  302. {
  303. if(HouseInfo[i][hOwned] == 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You can't enter in this house.");
  304. if(HouseInfo[i][hLocked] == 0) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}This house it's already unlocked.");
  305. if(strcmp(pname, HouseInfo[i][hOwner], true)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}You aren't Owner of this house.");
  306. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}You've unlocked your house.");
  307. GameTextForPlayer(playerid, "House ~g~UnLocked", 5000, 3);
  308. HouseInfo[i][hLocked] = 0;
  309. }
  310. }
  311. return 1;
  312. }
  313.  
  314. //------------------------------------------------------------------------------
  315.  
  316. CMD:edithouse(playerid, params[])
  317. {
  318. ShowPlayerDialog(playerid, DIALOG_EDITID, DIALOG_STYLE_INPUT, "House ID", "{FFFFFF}Please, input below house ID wich you want to edit:", "Continue", "Exit");
  319. return 1;
  320. }
  321.  
  322. //------------------------------------------------------------------------------
  323.  
  324. CMD:housecmds(playerid, params[])
  325. {
  326. new Dialog[512];
  327. strcat(Dialog, "{FF0000}h-House Commands.\n\n", sizeof(Dialog));
  328. strcat(Dialog, "{FFCC33}/HouseCMDS {FFFFFF}- See this list with all commands.\n", sizeof(Dialog));
  329. strcat(Dialog, "{FFCC33}/BuyHouse {FFFFFF}- Buy a house.\n", sizeof(Dialog));
  330. strcat(Dialog, "{FFCC33}/SellHouse {FFFFFF}- Sell your house.\n", sizeof(Dialog));
  331. strcat(Dialog, "{FFCC33}/enter {FFFFFF}- Enter in a house.\n", sizeof(Dialog));
  332. strcat(Dialog, "{FFCC33}/exit {FFFFFF}- Exit from a house.\n", sizeof(Dialog));
  333. strcat(Dialog, "{FFCC33}/LockHouse {FFFFFF}- Locks your house.\n", sizeof(Dialog));
  334. strcat(Dialog, "{FFCC33}/UnlockHouse {FFFFFF}- Unlocks your house.\n\n", sizeof(Dialog));
  335. ShowPlayerDialog(playerid, DIALOG_CMDS, DIALOG_STYLE_MSGBOX, "h-House Commands", Dialog, "Exit", "");
  336. return 1;
  337. }
  338.  
  339. //------------------------------------------------------------------------------
  340.  
  341. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  342. {
  343. if(dialogid == DIALOG_EDITID)
  344. {
  345. if(response)
  346. {
  347. new string[144], file[50];
  348. hid = strval(inputtext);
  349. format(file, sizeof(file), "Houses/%d.ini", hid);
  350. if(!fexist(file)) return SendClientMessage(playerid, -1, "{FF0000}ERROR: {FFFFFF}This house doesn't exist in data-base.");
  351. format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}Currently editing house: {FF0000}%d.", strval(inputtext));
  352. SendClientMessage(playerid, -1, string);
  353. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  354. }
  355. else
  356. {
  357. SendClientMessage(playerid, -1, "{FF0000}[HOUSE]: {FFFFFF}You don't edit house now.");
  358. }
  359. }
  360. if(dialogid == DIALOG_EDIT)
  361. {
  362. if(response)
  363. {
  364. if(listitem == 0)
  365. {
  366. ShowPlayerDialog(playerid, DIALOG_EDITPRICE, DIALOG_STYLE_INPUT, "Edit Price", "{FFFFFF}Please, input below new house's price:", "Continue", "Back");
  367. }
  368. if(listitem == 1)
  369. {
  370. ShowPlayerDialog(playerid, DIALOG_EDITINTERIOR, DIALOG_STYLE_INPUT, "Edit Interior", "{FFFFFF}Please, input below house's interior:", "Continue", "Back");
  371. }
  372. if(listitem == 2)
  373. {
  374. new file[50], string[144];
  375. HouseInfo[hid][hOwned] = 0;
  376. format(file, sizeof(file), "Houses/%d.ini", hid);
  377. if(fexist(file))
  378. {
  379. dini_IntSet(file, "Owned", 0);
  380. }
  381. format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}House setted ownable.");
  382. SendClientMessage(playerid, -1, string);
  383. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  384. }
  385. if(listitem == 3)
  386. {
  387. HouseInfo[hid][hLocked] = 1;
  388. SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}House locked.");
  389. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  390. }
  391. if(listitem == 4)
  392. {
  393. HouseInfo[hid][hLocked] = 0;
  394. SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}House unlocked.");
  395. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  396. }
  397. if(listitem == 5)
  398. {
  399. SetPlayerPos(playerid, HouseInfo[hid][hX], HouseInfo[hid][hY], HouseInfo[hid][hZ]);
  400. SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}Teleported to house.");
  401. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  402. }
  403. if(listitem == 6)
  404. {
  405. SetPlayerPos(playerid, HouseInfo[hid][hX], HouseInfo[hid][hY], HouseInfo[hid][hZ]);
  406. SetPlayerInterior(playerid, HouseInfo[hid][hInterior]);
  407. SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}Entered in house.");
  408. }
  409. if(listitem == 7)
  410. {
  411. SetPlayerPos(playerid, HouseInfo[hid][hX], HouseInfo[hid][hY], HouseInfo[hid][hZ]);
  412. SetPlayerInterior(playerid, 0);
  413. SendClientMessage(playerid, -1, "{FF0000}[EDIT-MODE]: {FFFFFF}House exited to pick-up position.");
  414. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  415. }
  416. }
  417. else
  418. {
  419. ShowPlayerDialog(playerid, DIALOG_EDITID, DIALOG_STYLE_INPUT, "House ID", "{FFFFFF}Please, input below house ID wich you want to edit:", "Continue", "Exit");
  420. }
  421. }
  422. if(dialogid == DIALOG_EDITPRICE)
  423. {
  424. if(response)
  425. {
  426. new file[50], string[144];
  427. HouseInfo[hid][hPrice] = strval(inputtext);
  428. format(file, sizeof(file), "Houses/%d.ini", hid);
  429. if(fexist(file))
  430. {
  431. dini_IntSet(file, "Price", HouseInfo[hid][hPrice]);
  432. }
  433. format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}New price of house: {FF0000}%d {FFFFFF}it's {FF0000}%d.", hid, HouseInfo[hid][hPrice]);
  434. SendClientMessage(playerid, -1, string);
  435. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  436. }
  437. else
  438. {
  439. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  440. }
  441. }
  442. if(dialogid == DIALOG_EDITINTERIOR)
  443. {
  444. if(response)
  445. {
  446. new file[50], string[144];
  447. HouseInfo[hid][hInterior] = strval(inputtext);
  448. format(file, sizeof(file), "Houses/%d.ini", hid);
  449. if(fexist(file))
  450. {
  451. dini_IntSet(file, "Interior", HouseInfo[hid][hInterior]);
  452. }
  453. format(string, sizeof(string), "{FF0000}[EDIT-MODE]: {FFFFFF}New interior of house: {FF0000}%d {FFFFFF}it's {FF0000}%d.", hid, HouseInfo[hid][hInterior]);
  454. SendClientMessage(playerid, -1, string);
  455. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  456. }
  457. else
  458. {
  459. ShowPlayerDialog(playerid, DIALOG_EDIT, DIALOG_STYLE_LIST, "Edit House:", "Edit Price\nEdit Interior\nSet Owned\nLock House\nUnlock House\nTeleport House\nEnter House\nExit House", "Select", "Back");
  460. }
  461. }
  462. return 1;
  463. }
  464.  
  465. //------------------------------------------------------------------------------
  466.  
  467. public OnFilterScriptInit()
  468. {
  469. LoadHouses();
  470. return 1;
  471. }
  472.  
  473. //------------------------------------------------------------------------------
  474.  
  475. stock LoadHouses()
  476. {
  477. new file[50], labelstring[144], stringlabel[144];
  478. for(new i = 0; i < MAX_HOUSES; i++)
  479. {
  480. format(file, sizeof(file), "Houses/%d.ini", i);
  481. if(fexist(file))
  482. {
  483. HouseInfo[i][hOwned] = dini_Int(file, "Owned");
  484. HouseInfo[i][hPrice] = dini_Int(file, "Price");
  485. HouseInfo[i][hInterior] = dini_Int(file, "Interior");
  486. HouseInfo[i][hX] = dini_Float(file, "Position X");
  487. HouseInfo[i][hY] = dini_Float(file, "Position Y");
  488. HouseInfo[i][hZ] = dini_Float(file, "Position Z");
  489. HouseInfo[i][hEnterX] = dini_Float(file, "Enter X");
  490. HouseInfo[i][hEnterY] = dini_Float(file, "Enter Y");
  491. HouseInfo[i][hEnterZ] = dini_Float(file, "Enter Z");
  492. strmid(HouseInfo[i][hOwner], dini_Get(file, "Owner"), false, strlen(dini_Get(file, "Owner")), MAX_PLAYER_NAME);
  493. format(labelstring, sizeof(labelstring), "{15FF00}House ID: {FFFFFF}%d\n{15FF00}Status: {FFFFFF}For Sale\n{15FF00}Price: {FFFFFF}%d", i, HouseInfo[i][hPrice]);
  494. format(stringlabel, sizeof(stringlabel), "{15FF00}House ID: {FFFFFF}%d\n{15FF00}Owner: {FFFFFF}%s\n{15FF00}Price: {FFFFFF}%d", i, HouseInfo[i][hOwner], HouseInfo[i][hPrice]);
  495. if(HouseInfo[i][hOwned] == 0)
  496. {
  497. HouseInfo[i][hPick] = CreatePickup(1273, 1, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]);
  498. HouseInfo[i][hLabel] = Create3DTextLabel(labelstring, 0xFFFFFFFF, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ], 30.0, 0, 0);
  499. }
  500. else if(HouseInfo[i][hOwned] == 1)
  501. {
  502. HouseInfo[i][hPick] = CreatePickup(1272, 1, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ]);
  503. HouseInfo[i][hLabel] = Create3DTextLabel(stringlabel, 0xFFFFFFFF, HouseInfo[i][hX], HouseInfo[i][hY], HouseInfo[i][hZ], 30.0, 0, 0);
  504. }
  505. houseid++;
  506. }
  507. }
  508. print(" ");
  509. print(" ");
  510. printf(" LOADED HOUSE: %d/%d", houseid, MAX_HOUSES);
  511. print(" ");
  512. print(" ");
  513. return 1;
  514. }
  515.  
  516. //Cum se salveaza in Dini
  517. Price=10000
  518. Interior=11
  519. Level=3
  520. Owned=1
  521. Position X=980.508300
  522. Position Y=-677.248718
  523. Position Z=121.976257
  524. Enter X=2282.909912
  525. Enter Y=-1137.971191
  526. Enter Z=1050.898437
  527. Owner=OscarJoaca
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement