Advertisement
Guest User

Easy ~ sHHausSystem v.1.0

a guest
Jun 15th, 2011
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.18 KB | None | 0 0
  1. /*
  2. _________________________________________________
  3. | Scriptname : Haus-System |
  4. | Version : 1.0 |
  5. | |
  6. | Eine Produktion vom Script SAMP-Hilfe.de Team |
  7. | |
  8. | Erstellt am: 25.05.2011 |
  9. | Mapname: - |
  10. | |
  11. | Hauptscripter: SAMP-Hilfe |
  12. | Co-Scripter: - |
  13. | Tester: DaveAdU + VitO + Erdal |
  14. | |
  15. | Info: |
  16. | Bitte die Copyriht drine lassen ! |
  17. | |
  18. |_________________________________________________|
  19. | |
  20. | Herstellerseite: www.SAMP-Hilfe.de |
  21. | ICQ Messenger: 317-105-176 |
  22. | |
  23. | Copyright 2011 by SAMP-Hilfe |
  24. |_________________________________________________|
  25. */
  26.  
  27. #include <a_samp>
  28. #include <dini>
  29. #include <dudb>
  30. //#include <MapIconStreamer>
  31. #include <nIcons>
  32.  
  33. #pragma unused strtok
  34. #pragma unused ret_memcpy
  35. #pragma unused nIconAddForAll
  36.  
  37. forward OnPlayerHouse();
  38. new point;
  39.  
  40. enum PLAYER_PARAMS
  41. {
  42. HouseArea
  43. }
  44.  
  45. new PlayerParameters[MAX_PLAYERS][PLAYER_PARAMS];
  46.  
  47. #define MAX_HOUSES 55
  48.  
  49. new HouseInfo[MAX_HOUSES];
  50.  
  51. new InfoPoint[MAX_HOUSES][256];
  52.  
  53. new H_Icon[MAX_PLAYERS][MAX_HOUSES];
  54.  
  55. new pCP[MAX_PLAYERS];
  56.  
  57. new Menu:menu;
  58.  
  59. new hmode[MAX_PLAYERS];
  60.  
  61. new InHouse[MAX_PLAYERS];
  62.  
  63. //new HouseCP[MAX_HOUSES];
  64.  
  65. new IsIcon[MAX_PLAYERS][MAX_HOUSES];
  66.  
  67. new Float:hPos[MAX_PLAYERS][3];
  68.  
  69. #define GREEN 0x33AA33AA
  70. #define RED 0xAA3333AA
  71. #define COLOR_LIGHTRED 0xFF0000AA
  72. #define COLOR_YELLOW 0xFFFF00AA
  73. #define WHITE 0xFFFFFFAA
  74.  
  75. forward SpawnAtHouse(playerid);
  76.  
  77. public OnFilterScriptInit()
  78. {
  79. print("+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+");
  80. print("+~ Haus System by SAMP-Hilfe ~+");
  81. print("+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+");
  82. nIconsInit();
  83. SetTimer("OnPlayerHouse", 800, 1);
  84.  
  85. menu = CreateMenu("Zuhause", 2, 200.0, 100.0, 150.0, 150.0);
  86.  
  87. AddMenuItem(menu, 0, "Essen");
  88. AddMenuItem(menu, 0, "Trinken");
  89. AddMenuItem(menu, 0, "Schutzweste");
  90. AddMenuItem(menu, 0, "Sawnoff holen");
  91. AddMenuItem(menu, 0, "M4 holen");
  92. AddMenuItem(menu, 0, "Tec9 holen");
  93. AddMenuItem(menu, 0, "Messer holen");
  94. AddMenuItem(menu, 0, "Menu verlassen");
  95. return 1;
  96. }
  97.  
  98. stock HouseCheckpointUpdate(playerid)
  99. { // X Y Z intX intY intZ Name Preis - ID CP int v score
  100.  
  101. // ============================ [Ganton] ================================ //
  102. AddHouse(playerid,2498.4651,-1643.4498,13.7826, 244.4119,305.0329,999.1484, "Nr. 1", 80000, true, 0, 5/2, 1, 1, 400); // Ganton Haus, Klein
  103. AddHouse(playerid,2512.8579,-1650.8561,14.0938, 271.8849,306.6319,999.1484, "Nr. 2", 90000, true, 1, 5/2, 2, 2, 450); // Ganton Haus, Klein
  104. AddHouse(playerid,2413.7310,-1647.5107,13.7500, 244.4119,305.0329,999.1484, "Nr. 3", 85000, true, 2, 5/2, 1, 3, 600); // Ganton Haus, Klein
  105. AddHouse(playerid,2362.7473,-1643.7504,14.0596, 271.8849,306.6319,999.1484, "Nr. 4", 100000, true, 3, 5/2, 2, 4, 550); // Ganton Haus, Klein
  106. AddHouse(playerid,2308.7966,-1715.1124,14.6496, 244.4119,305.0329,999.1484, "Nr. 5", 95000, true, 4, 5/2, 1, 5, 490); // Ganton Haus, Klein
  107.  
  108. // ========================== [Idlewood] ================================ //
  109. AddHouse(playerid,2142.6399,-1605.8600,14.3516, 244.4119,305.0329,999.1484, "Nr. 6", 120000, true, 5, 5/2, 1, 6, 600); // Idlewood Wohnung, Klein
  110. AddHouse(playerid,2140.6243,-1652.0769,15.0859, 244.4119,305.0329,999.1484, "Nr. 7", 180000, true, 6, 5/2, 1, 7, 820); // Idlewood Wohnung, Klein
  111. AddHouse(playerid,2016.3441,-1629.8438,13.5469, 271.8849,306.6319,999.1484, "Nr. 8", 1100000, true, 7, 5/2, 2, 8, 570); // Idlewood Haus, Klein
  112.  
  113. // ========================== [El Corona] =============================== //
  114. AddHouse(playerid,1937.2717,-1911.5787,15.2568, 244.4119,305.0329,999.1484, "Nr. 9", 140000, true, 8, 5/2, 1, 9, 680); // El Corona Haus, Klein
  115. AddHouse(playerid,1892.0405,-1916.1093,15.2568, 271.8849,306.6319,999.1484, "Nr. 10", 150000, true, 9, 5/2, 2, 10, 700); // El Corona Haus, Klein
  116. AddHouse(playerid,1854.2461,-1915.4453,15.2568, 244.4119,305.0329,999.1484, "Nr. 11", 170000, true, 10, 5/2, 1, 11, 770); // El Corona Haus, Klein
  117.  
  118. // ========================= [Verona Beach] ============================= //
  119. AddHouse(playerid,865.1669,-1634.8881,14.9297, 290.4616,1475.1036,1080.2578, "Nr. 12", 180000, true, 11, 5/2, 15, 12, 780); // Verona Beach Wohung, Mittel
  120. AddHouse(playerid,798.1665,-1728.9434,13.5469, 2454.7170,-1700.8715,1013.5151, "Nr. 13", 190000, true, 12, 5/2, 2, 13, 880); // Verona Beach Haus, Mittel
  121. AddHouse(playerid,795.0920,-1691.1942,14.4633, 2324.4199,-1145.5683,1050.7100, "Nr. 14", 200000, true, 13, 5/2, 12, 14, 650); // Verona Beach Haus, Mittel
  122. AddHouse(playerid,305.3226,-1771.3724,4.5383, 245.8472,304.7715,999.1484, "Nr. 15", 220000, true, 14, 5/2, 1, 15, 820); // Verona Beach Haus, Klein
  123. AddHouse(playerid,280.9468,-1768.6292,4.5159, 2454.7170,-1700.8715,1013.5151, "Nr. 16", 240000, true, 15, 5/2, 2, 16, 900); // Verona Beach Haus, Mittel
  124. AddHouse(playerid,206.9534,-1770.4280,4.3414, 235.508994,1189.169897,1080.339966, "Nr. 17", 300000, true, 16, 5/2, 3, 17, 1000); // Verona Beach Haus, Groß
  125. AddHouse(playerid,168.2644,-1769.2476,4.4744, 225.630997,1022.479980,1084.069946, "Nr. 18", 350000, true, 17, 5/2, 7, 18, 1100); // Verona Beach Haus, Groß
  126.  
  127. // ============================ [Marina] ================================ //
  128. AddHouse(playerid,656.9088,-1652.3427,15.4063, 2454.7170,-1700.8715,1013.5151, "Nr. 19", 195000, true, 18, 5/2, 2, 19, 760); // Marina Haus, Mittel
  129. AddHouse(playerid,693.2025,-1601.8683,15.0469, 2324.4199,-1145.5683,1050.7100, "Nr. 20", 186000, true, 19, 5/2, 12, 20, 840); // Marina Haus, Mittel
  130. AddHouse(playerid,694.0329,-1705.7675,3.8195, 2454.7170,-1700.8715,1013.5151, "Nr. 21", 192000, true, 20, 5/2, 2, 21, 710); // Marina Haus, Mittel
  131.  
  132. // =========================== [Vinewood] =============================== //
  133. AddHouse(playerid,297.7927,-1337.0178,53.4415, 235.508994,1189.169897,1080.339966, "Nr. 22", 310000, true, 21, 5/2, 3, 22, 1050); // Vinewood Haus, Groß
  134. AddHouse(playerid,397.9923,-1271.4000,50.0198, 225.630997,1022.479980,1084.069946, "Nr. 23", 320000, true, 22, 5/2, 7, 23, 1200); // Vinewood Haus, Groß
  135. AddHouse(playerid,431.6050,-1252.6893,51.5809, 235.508994,1189.169897,1080.339966, "Nr. 24", 315000, true, 23, 5/2, 3, 24, 1300); // Vinewood Haus, Groß
  136. AddHouse(playerid,552.8708,-1200.1661,44.8315, 225.630997,1022.479980,1084.069946, "Nr. 25", 330000, true, 24, 5/2, 7, 25, 1150); // Vinewood Haus, Groß
  137. AddHouse(playerid,497.5518,-1094.4314,82.3592, 235.508994,1189.169897,1080.339966, "Nr. 26", 350000, true, 25, 5/2, 3, 26, 1250); // Vinewood Haus, Groß
  138. AddHouse(playerid,724.9747,-998.1309,52.7344, 225.630997,1022.479980,1084.069946, "Nr. 27", 340000, true, 26, 5/2, 7, 27, 1350); // Vinewood Haus, Groß
  139. AddHouse(playerid,909.8192,-816.4182,103.1260, 235.508994,1189.169897,1080.339966, "Nr. 28", 320000, true, 27, 5/2, 3, 28, 1400); // Vinewood Haus, Groß
  140. AddHouse(playerid,1093.7415,-805.5349,107.4189, 225.630997,1022.479980,1084.069946, "Nr. 29", 360000, true, 28, 5/2, 7, 29, 1150); // Vinewood Haus, Groß
  141. AddHouse(playerid,898.7935,-677.9189,116.8904, 235.508994,1189.169897,1080.339966, "Nr. 30", 370000, true, 29, 5/2, 3, 30, 1500); // Vinewood Haus, Groß
  142. AddHouse(playerid,868.1270,-716.3992,105.6797, 225.630997,1022.479980,1084.069946, "Nr. 31", 380000, true, 30, 5/2, 7, 31, 1550); // Vinewood Haus, Groß
  143. AddHouse(playerid,848.7702,-745.1958,94.9693, 235.508994,1189.169897,1080.339966, "Nr. 32", 300000, true, 31, 5/2, 3, 32, 1600); // Vinewood Haus, Groß
  144. AddHouse(playerid,809.3463,-758.9326,76.5314, 225.630997,1022.479980,1084.069946, "Nr. 33", 390000, true, 32, 5/2, 7, 33, 1100); // Vinewood Haus, Groß
  145.  
  146. // ========================= [Mullholland] ============================== //
  147. AddHouse(playerid,1248.3545,-877.4985,46.6406, 295.1389,1474.4699,1080.5198, "Nr. 34", 150000, true, 33, 5/2, 15, 34, 660); // Mullholland Wohung, Mittel
  148. AddHouse(playerid,1290.5410,-897.0990,46.6251, 385.8039,1471.7698,1080.2099, "Nr. 35", 133000, true, 34, 5/2, 15, 35, 590); // Mullholland Wohung, Mittel
  149.  
  150. // ======================= [Playa de Seville] =========================== //
  151. AddHouse(playerid,2802.8972,-1963.0831,13.5469, 244.4119,305.0329,999.1484, "Nr. 36", 122000, true, 35, 5/2, 1, 36, 610); // Playa de Seville Wohung, klein
  152.  
  153. // ========================= [Willowfield] ============================== //
  154. AddHouse(playerid,2333.2524,-1944.5338,14.9688, 244.4119,305.0329,999.1484, "Nr. 37", 85000, true, 36, 5/2, 1, 37, 440); // Willowfield Wohung, klein
  155. AddHouse(playerid,2296.5334,-1883.3855,14.2344, 271.8849,306.6319,999.1484, "Nr. 38", 91000, true, 37, 5/2, 2, 38, 500); // Willowfield Wohung, klein
  156. AddHouse(playerid,2261.4285,-1905.9822,14.9375, 244.4119,305.0329,999.1484, "Nr. 39", 87000, true, 38, 5/2, 1, 39, 490); // Willowfield Wohung, klein
  157. AddHouse(playerid,2241.8647,-1882.9817,14.2344, 271.8849,306.6319,999.1484, "Nr. 40", 99000, true, 39, 5/2, 2, 40, 390); // Willowfield Wohung, klein
  158.  
  159. // ========================= [Las Colinas] ============================== //
  160. AddHouse(playerid,2043.9211,-966.1533,43.7993, 2454.7170,-1700.8715,1013.5151, "Nr. 41", 285000, true, 40, 5/2, 2, 41, 640); // Las Colinas Haus, Mittel
  161. AddHouse(playerid,2122.6895,-970.0249,58.2074, 271.8849,306.6319,999.1484, "Nr. 42", 87000, true, 41, 5/2, 2, 42, 770); // Las Colinas Haus, Klein
  162. AddHouse(playerid,2260.4504,-1019.9237,59.2901, 2324.4199,-1145.5683,1050.7100, "Nr. 43", 88000, true, 42, 5/2, 12, 43, 650); // Las Colinas Haus, Mittel
  163. AddHouse(playerid,2287.6318,-1080.5319,47.7299, 244.4119,305.0329,999.1484, "Nr. 44", 90000, true, 43, 5/2, 1, 44, 910); // Las Colinas Haus, Klein
  164. AddHouse(playerid,2335.3860,-1044.3040,52.3582, 271.8849,306.6319,999.1484, "Nr. 45", 76000, true, 44, 5/2, 2, 45, 700); // Las Colinas Haus, Klein
  165. AddHouse(playerid,2373.0625,-1052.2159,54.1343, 244.4119,305.0329,999.1484, "Nr. 46", 74000, true, 45, 5/2, 1, 46, 550); // Las Colinas Haus, Klein
  166. AddHouse(playerid,2389.4150,-1037.9227,53.5661, 271.8849,306.6319,999.1484, "Nr. 47", 69000, true, 46, 5/2, 2, 47, 610); // Las Colinas Haus, Klein
  167. AddHouse(playerid,2440.3816,-1056.5548,54.7387, 244.4119,305.0329,999.1484, "Nr. 48", 98000, true, 47, 5/2, 1, 48, 760); // Las Colinas Haus, Klein
  168. AddHouse(playerid,2440.4692,-1010.7724,54.3438, 271.8849,306.6319,999.1484, "Nr. 49", 77000, true, 48, 5/2, 2, 49, 520); // Las Colinas Haus, Klein
  169. AddHouse(playerid,2478.8416,-1063.2539,66.8359, 244.4119,305.0329,999.1484, "Nr. 50", 89000, true, 49, 5/2, 1, 50, 430); // Las Colinas Haus, Klein
  170. AddHouse(playerid,2560.4478,-1034.3489,69.5742, 271.8849,306.6319,999.1484, "Nr. 51", 100000, true, 50, 5/2, 2, 51, 410); // Las Colinas Haus, Klein
  171. AddHouse(playerid,2629.0369,-1068.2804,69.6141, 2454.7170,-1700.8715,1013.5151, "Nr. 52", 59000, true, 51, 5/2, 2, 52, 999); // Las Colinas Haus, Mittel
  172. AddHouse(playerid,2626.8401,-1098.6176,69.3709, 2324.4199,-1145.5683,1050.7100, "Nr. 53", 301000, true, 52, 5/2, 12, 53, 1100); // Las Colinas Haus, Mittel
  173.  
  174. hmode[playerid]=1;
  175. return 1;
  176. }
  177.  
  178. stock AddHouse(playerid, Float:x, Float:y, Float:z, Float:ix, Float:iy, Float:iz, name[], preis, bool:kaufbar, houseid, cpsize, interiorid, vwid, score)
  179. {
  180. if(hmode[playerid]==0)
  181. {
  182. if(!fexist(HouseFile(houseid)))
  183. {
  184. dini_Create(HouseFile(houseid));
  185. dini_Set(HouseFile(houseid), "Name", name);
  186. dini_IntSet(HouseFile(houseid), "Preis", preis);
  187. dini_FloatSet(HouseFile(houseid), "x", x);
  188. dini_FloatSet(HouseFile(houseid), "y", y);
  189. dini_FloatSet(HouseFile(houseid), "z", z);
  190. dini_FloatSet(HouseFile(houseid), "ix", ix);
  191. dini_FloatSet(HouseFile(houseid), "iy", iy);
  192. dini_FloatSet(HouseFile(houseid), "iz", iz);
  193. dini_IntSet(HouseFile(houseid), "InteriorID", interiorid);
  194. dini_IntSet(HouseFile(houseid), "VirtualWorld", vwid);
  195. dini_IntSet(HouseFile(houseid), "Score", score);
  196. if(kaufbar)
  197. {
  198. dini_IntSet(HouseFile(houseid), "Kaufbar", 1);
  199. //H_Icon = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  200. } else {
  201. dini_IntSet(HouseFile(houseid), "Kaufbar", 0);
  202. // H_Icon = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  203. }
  204. }
  205.  
  206. //new Float:xp, Float:yp, Float:zp;
  207. //GetPlayerPos(playerid, xp, yp, zp);
  208. /*if(PlayerToPoint(7, playerid, x,y,z))
  209. {
  210. PlayerParameters[playerid][HouseArea]=houseid;
  211. HouseInfo[houseid]=1;
  212. if(!IsPlayerInCheckpoint(playerid)) point = SetPlayerCheckpoint(playerid, x, y, z, cpsize);
  213. } else if(PlayerParameters[playerid][HouseArea]==houseid)
  214. {
  215. DisablePlayerCheckpoint(playerid);
  216. PlayerParameters[playerid][HouseArea]=-1;
  217. HouseInfo[houseid]=0;
  218. }*/
  219. //HouseCP[houseid] = CPS_AddCheckpoint(x,y,z,cpsize,7);
  220.  
  221. //if(/*GetDistanceBetweenTwoPoints(x,y, xp,yp) < 40)*/PlayerToPoint(70, playerid, x, y, z))
  222. //{
  223. //if(PlayerParameters[playerid][HouseArea]!=houseid)
  224. //{
  225. //SetPlayerCheckpoint(playerid, x, y, z, cpsize);
  226. //PlayerParameters[playerid][HouseArea]=houseid;
  227. /*if(kaufbar)
  228. {
  229. H_Icon = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  230. } else {
  231. H_Icon = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  232. }*/
  233. /*DestroyMapIcon(H_Icon[houseid]);
  234. if(dini_Int(HouseFile(houseid), "Kaufbar") == 0)
  235. {
  236. H_Icon[houseid] = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  237. } else {
  238. H_Icon[houseid] = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  239. }*/
  240. if(IsIcon[playerid][houseid] == 0)
  241. {
  242. H_Icon[playerid][houseid] = nIconAddForPlayer(playerid,x,y,z,31);
  243. IsIcon[playerid][houseid] = 1;
  244. }
  245. if(dini_Int(HouseFile(houseid), "Kaufbar") == 1)
  246. {
  247. nIconDestroy(playerid,H_Icon[playerid][houseid]);
  248. nIconAddForPlayer(playerid,x,y,z,31);
  249. } else //ChangeMapIconInfo(playerid,H_Icon[playerid][houseid], x,y,z, 31, 800);
  250. if(dini_Int(HouseFile(houseid), "Kaufbar") == 0)
  251. {
  252. //ChangeMapIconInfo(playerid,H_Icon[playerid][houseid], x,y,z, 32, 800);
  253. nIconDestroy(playerid,H_Icon[playerid][houseid]);
  254. nIconAddForPlayer(playerid,x,y,z,32);
  255. }
  256. // }
  257. /*} else //if(PlayerParameters[playerid][HouseArea]==houseid)
  258. {
  259. //PlayerParameters[playerid][HouseArea]=-1;
  260. //DisablePlayerCheckpoint(playerid);
  261. DestroyMapIcon(H_Icon[houseid]);
  262. }*/
  263.  
  264. HouseInfo[houseid]=1;
  265. } else {
  266. if(PlayerToPoint(7, playerid, x,y,z))
  267. {
  268. PlayerParameters[playerid][HouseArea]=houseid;
  269. HouseInfo[houseid]=1;
  270. if(!IsPlayerInCheckpoint(playerid)) point = SetPlayerCheckpoint(playerid, x, y, z, cpsize);
  271. } else if(PlayerParameters[playerid][HouseArea]==houseid)
  272. {
  273. DisablePlayerCheckpoint(playerid);
  274. PlayerParameters[playerid][HouseArea]=-1;
  275. HouseInfo[houseid]=0;
  276. }
  277. }
  278. return 1;
  279. }
  280.  
  281. stock HouseFile(house)
  282. {
  283. new string[256];
  284. format(string, sizeof(string), "/HSystem/%d.house", house);
  285. return string;
  286. }
  287.  
  288. stock PlayerFile(playerid)
  289. {
  290. new string[256];
  291. format(string,sizeof(string), "/HSystem/User/%s.owner", Playername(playerid));
  292. return string;
  293. }
  294.  
  295. stock GetDistanceBetweenTwoPoints(Float:x,Float:y, Float:x1,Float:y1)
  296. {
  297. new Float:tmpdis;
  298. tmpdis = floatsqroot(floatpower(floatabs(floatsub(x,x1)),2)+floatpower(floatabs(floatsub(y,y1)),2));
  299. return floatround(tmpdis);
  300. }
  301.  
  302. stock SendPlayerText(playerid, const text[])
  303. {
  304. return SendClientMessage(playerid, 0xFFFF00FF, text);
  305. }
  306.  
  307. stock SendClientText(playerid, const text[])
  308. {
  309. return SendClientMessage(playerid, COLOR_YELLOW, text);
  310. }
  311.  
  312. stock SendErrorText(playerid, const text[])
  313. {
  314. return SendClientMessage(playerid, WHITE, text);
  315. }
  316.  
  317. stock GetPlayerid(name[])
  318. {
  319. for (new i = 0; i < MAX_PLAYERS; i++)
  320. {
  321. if (IsPlayerConnected(i))
  322. {
  323. if(strcmp(Playername(i), name, true) == 0)
  324. {
  325. return i;
  326. }
  327. }
  328. }
  329. return INVALID_PLAYER_ID;
  330. }
  331.  
  332.  
  333. stock Playername(playerid) {
  334. new name[MAX_PLAYER_NAME];
  335. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  336. return name;
  337. }
  338.  
  339. stock str(value)
  340. {
  341. new string[256];
  342. format(string, sizeof(string), "%d", value);
  343. return string;
  344. }
  345.  
  346. public OnPlayerEnterCheckpoint(playerid)
  347. {/*
  348. new houseid;
  349. new CP = CPS_GetPlayerCheckpoint(playerid);
  350. //for(new i = 0; i<MAX_HOUSES; i++)
  351. //{
  352. //if(CP == HouseCP[i])
  353. //{
  354. houseid = HouseCP[CP];
  355. new string[256];
  356. // new string[256], houseid;
  357. // houseid=PlayerParameters[playerid][HouseArea];
  358. if(HouseInfo[houseid]==1)
  359. {
  360. if(dini_Int(HouseFile(houseid), "Kaufbar") == 1){
  361. SendPlayerText(playerid, "[INFO] Haus steht zum Verkauf !");
  362. format(string, sizeof(string), "Preis: %d | Score: %d", dini_Int(HouseFile(houseid), "Preis"), dini_Int(HouseFile(houseid), "Score"));
  363. SendPlayerText(playerid, string);
  364. format(string, sizeof(string), "Haus: %s", dini_Get(HouseFile(houseid), "Name"));
  365. SendPlayerText(playerid, string);
  366. SendPlayerText(playerid, "Befehl: /kaufen");
  367. }
  368. if(dini_Isset(HouseFile(houseid), "Besitzer"))
  369. {
  370. format(string, sizeof(string), "Haus: %s", dini_Get(HouseFile(houseid), "Name"));
  371. SendPlayerText(playerid, string);
  372. format(string, sizeof(string), "Besitzer: %s", dini_Get(HouseFile(houseid), "Besitzer"));
  373. SendPlayerText(playerid, string);
  374. }
  375. } else if(HouseInfo[houseid]==2)
  376. {
  377. SendPlayerText(playerid, InfoPoint[houseid]);
  378. }
  379. // }
  380. //}
  381. */
  382. new string[256], houseid;
  383. houseid=PlayerParameters[playerid][HouseArea];
  384. if(HouseInfo[houseid]==1)
  385. {
  386. if(dini_Int(HouseFile(houseid), "Kaufbar") == 1){
  387. format(string, sizeof(string), "== Du kannst Haus %s für %d $ & %s Score kaufen (/househelp)", dini_Get(HouseFile(houseid), "Name"),dini_Int(HouseFile(houseid), "Preis"), dini_Get(HouseFile(houseid), "Score"));
  388. SendPlayerText(playerid, string);
  389. }
  390. if(dini_Isset(HouseFile(houseid), "Besitzer"))
  391. {
  392. format(string, sizeof(string), "== Haus %s gehört %s", dini_Get(HouseFile(houseid), "Name"),dini_Get(HouseFile(houseid), "Besitzer"));
  393. SendPlayerText(playerid, string);
  394. }
  395. } else if(HouseInfo[houseid]==2)
  396. {
  397. SendPlayerText(playerid, InfoPoint[houseid]);
  398. }
  399. return 1;
  400. }
  401.  
  402. public OnPlayerHouse()
  403. {
  404. for (new i = 0; i < MAX_PLAYERS; i++)
  405. {
  406. if (IsPlayerConnected(i))
  407. {
  408. HouseCheckpointUpdate(i);
  409. }
  410. }
  411. return 1;
  412. }
  413.  
  414. public OnPlayerConnect(playerid)
  415. {
  416. hmode[playerid]=0;
  417. //tAxI_OnPlayerConnect2(playerid);
  418. //HouseCheckpointUpdate(playerid);
  419. //SetTimerEx("HouseCheckpointUpdate", 800, 1, "d", playerid);
  420. SetPlayerVirtualWorld(playerid, 0);
  421. InHouse[playerid]=0;
  422. pCP[playerid]=0;
  423. //SendClientMessage(playerid, GREEN, "== Haussystem Version 1.0 by SAMP-Hilfe.de ==");
  424. return 1;
  425. }
  426.  
  427. public OnPlayerSpawn(playerid)
  428. {
  429. SpawnAtHouse(playerid);
  430. return 1;
  431. }
  432.  
  433. public OnPlayerDisconnect(playerid, reason)
  434. {
  435. //tAxI_OnPlayerDisconnect(playerid);
  436. return 1;
  437. }
  438.  
  439. public OnPlayerCommandText(playerid, cmdtext[])
  440. {
  441. new string[256];
  442. new name[MAX_PLAYER_NAME];
  443. GetPlayerName(playerid,name,sizeof(name));
  444. if(strcmp(cmdtext, "/kaufen", true) == 0)
  445. {
  446. new houseid = PlayerParameters[playerid][HouseArea];
  447. if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen!");
  448. if(fexist(PlayerFile(playerid)))
  449. {
  450. if(dini_Int(PlayerFile(playerid), "OwnHaus") == 1) return SendErrorText(playerid, "SERVER: Du hast bereits ein Haus!");
  451. }
  452. if(strcmp(dini_Get(HouseFile(houseid), "Name"), Playername(playerid), true) == 0) return SendErrorText(playerid, "SERVER: Das Haus gehört dir schon!");
  453. if(dini_Int(HouseFile(houseid), "Kaufbar") == 0) return SendErrorText(playerid, "SERVER: Das Haus steht nicht zum Verkauf! Also kannst du es nicht kaufen!");
  454. new preis;
  455. new score;
  456. preis=dini_Int(HouseFile(houseid), "Preis");
  457. score=dini_Int(HouseFile(houseid), "Score");
  458. if(preis > GetPlayerMoney(playerid)) return SendErrorText(playerid, "SERVER: Du hast nicht genug Geld um dir das Haus zu Kaufen!");
  459. if(score > GetPlayerScore(playerid)) return SendErrorText(playerid, "SERVER: Du hast nicht genug Scores um dir das Haus zu Kaufen!");
  460.  
  461. /*if(dini_Isset(HouseFile(houseid), "Besitzer"))
  462. {
  463. format(string, sizeof(string), "[INFO] Du hast %s von %s abgekauft !", dini_Get(HouseFile(houseid), "Name"), dini_Get(HouseFile(houseid), "Besitzer"));
  464. SendPlayerText(playerid, string);
  465.  
  466. new sellerid = GetPlayerid(dini_Get(HouseFile(houseid), "Besitzer"));
  467. dini_Set(PlayerFile(sellerid), "OwnHaus", "0");
  468. dini_Set(PlayerFile(sellerid), "Haus", "-1");
  469. if(IsPlayerConnected(sellerid))
  470. {
  471. GivePlayerMoney(sellerid, preis);
  472. format(string, sizeof(string), "[INFO] %s hat einen Käufer gefunden ! Der neue Käufer von deinem Haus ist %s", dini_Get(HouseFile(houseid), "Name"), Playername(playerid));
  473. SendPlayerText(sellerid, string);
  474. } else {
  475. dini_IntSet(udb_encode(dini_Get(HouseFile(houseid), "Besitzer")), "money", preis + dini_Int(udb_encode(dini_Get(HouseFile(houseid), "Besitzer")), "money"));
  476. }
  477. } else {*/
  478. format(string, sizeof(string), "== Du hast dir Haus %s für %d gekauft! (/househelp)", dini_Get(HouseFile(houseid), "Name"),dini_Int(HouseFile(houseid), "Preis"));
  479. SendClientText(playerid, string);
  480. //}
  481.  
  482. dini_IntSet(HouseFile(houseid), "Kaufbar", 0);
  483. for(new i = 0;i<MAX_PLAYERS;i++) hmode[playerid]=0;
  484.  
  485. //DestroyMapIcon(H_Icon[houseid]);
  486. //H_Icon[houseid] = CreateMapIcon(32, RED, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  487.  
  488. GivePlayerMoney(playerid, preis * -1);
  489. dini_Set(HouseFile(houseid), "Besitzer", Playername(playerid));
  490.  
  491.  
  492. if(!fexist(PlayerFile(playerid))) dini_Create(PlayerFile(playerid));
  493. dini_Set(PlayerFile(playerid), "Name", Playername(playerid));
  494. dini_IntSet(PlayerFile(playerid), "Haus", houseid);
  495. dini_IntSet(PlayerFile(playerid), "OwnHaus", 1);
  496. return 1;
  497. }
  498.  
  499. if(strcmp(cmdtext, "/verkaufen", true) == 0)
  500. {
  501. new houseid = PlayerParameters[playerid][HouseArea];
  502. if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in deinen Haus Checkpoint stehen !");
  503.  
  504. if(!dini_Isset(HouseFile(houseid), "Besitzer")) return SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht !");
  505.  
  506. if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
  507. {
  508. new preis=dini_Int(HouseFile(houseid), "Preis");
  509. if(!fexist(PlayerFile(playerid))) dini_Create(PlayerFile(playerid));
  510. dini_IntSet(PlayerFile(playerid), "Haus", -1);
  511. dini_IntSet(PlayerFile(playerid), "OwnHaus", 0);
  512. GivePlayerMoney(playerid, preis);
  513.  
  514. //DestroyMapIcon(H_Icon[houseid]);
  515. //H_Icon[houseid] = CreateMapIcon(31, GREEN, dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"));
  516.  
  517. dini_IntSet(HouseFile(houseid), "Kaufbar", 1);
  518. dini_Unset(HouseFile(houseid), "Besitzer");
  519. SendClientText(playerid, "== Du hast dein Haus verkauft!");
  520. for(new i = 0;i<MAX_PLAYERS;i++) hmode[playerid]=0;
  521. } else {
  522. SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht!");
  523. }
  524.  
  525. //if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
  526. //{
  527. // if(!strlen(params)) return SendPlayerText(playerid, "USAGE: /sell [preis]");
  528. /*if(dini_Int(HouseFile(houseid), "Kaufbar") == 1) return SendPlayerText(playerid, "[INFO] Dein Haus steht schon zum Verkauf !");
  529. dini_IntSet(HouseFile(houseid), "Kaufbar", 1);
  530. SendPlayerText(playerid, "[INFO] Du hast dein Haus zum Verkauf freigegeben !");
  531. } else {
  532. SendPlayerText(playerid, "[INFO] Das Haus gehört dir nicht !");
  533. }
  534. return 1;
  535. }
  536. */
  537. return 1;
  538. }
  539.  
  540. /*
  541. if(strcmp(cmdtext, "/nvkaufen", true) == 0)
  542. {
  543. new houseid = PlayerParameters[playerid][HouseArea];
  544. if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendPlayerText(playerid, "[INFO] Du musst in einen Haus Checkpoint stehen !");
  545.  
  546. if(!dini_Isset(HouseFile(houseid), "Besitzer")) return SendPlayerText(playerid, "[INFO] Das Haus gehört dir nicht !");
  547.  
  548. if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
  549. {
  550. if(dini_Int(HouseFile(houseid), "Kaufbar") == 0) return SendPlayerText(playerid, "[INFO] Du hast dein Haus schon vom Verkauf weggenommen !");
  551. dini_IntSet(HouseFile(houseid), "Kaufbar", 0);
  552. SendPlayerText(playerid, "[INFO] Dein Haus steht nun nicht mehr zum Verkauf !");
  553. } else {
  554. SendPlayerText(playerid, "[INFO] Dieses Haus gehört dir nicht!");
  555. }
  556. return 1;
  557. }*/
  558.  
  559. if(strcmp(cmdtext, "/betreten", true) == 0)
  560. {
  561. new houseid = PlayerParameters[playerid][HouseArea];
  562. if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen !");
  563.  
  564. if(!dini_Isset(HouseFile(houseid), "Besitzer")) return SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht !");
  565.  
  566. if(strcmp(dini_Get(HouseFile(houseid), "Besitzer"), Playername(playerid), true) == 0)
  567. {
  568. for(new i = 0; i<MAX_PLAYERS; i++)
  569. {
  570. if(IsPlayerInCheckpoint(i) && point!=999)
  571. {
  572. if(PlayerParameters[i][HouseArea] == houseid)
  573. {
  574. GetPlayerPos(i, hPos[i][0], hPos[i][1], hPos[i][2]);
  575. SetPlayerPos(i, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
  576. SetPlayerInterior(i, dini_Int(HouseFile(houseid), "InteriorID"));
  577. SetPlayerVirtualWorld(i, dini_Int(HouseFile(houseid), "VirtualWorld"));
  578. InHouse[i] = 1;
  579. format(string, sizeof(string), "== Willkommen %s, bei %s im Haus (/househelp)", name, dini_Get(HouseFile(houseid), "Besitzer"), dini_Get(HouseFile(houseid), "name"));
  580. SendPlayerText(playerid, string);
  581. }
  582. }
  583. }
  584. //GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
  585. //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
  586. //SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
  587. //SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
  588. } else {
  589. SendErrorText(playerid, "SERVER: Das Haus gehört dir nicht!");
  590. }
  591. return 1;
  592. }
  593.  
  594. /*if(strcmp(cmdtext, "/rein", true) == 0)
  595. {
  596. if(!IsPlayerAdmin(playerid)) return SendErrorText(playerid, "SERVER: Du bist kein Administrator!");
  597. new houseid = PlayerParameters[playerid][HouseArea];
  598. if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen!");
  599.  
  600. if(IsPlayerInCheckpoint(playerid))
  601. {
  602. if(PlayerToPoint(1,dini_Int(HouseFile(houseid), "x"), dini_Int(HouseFile(houseid), "y"), dini_Int(HouseFile(houseid), "z"), playerid))
  603. {
  604. GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
  605. SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
  606. SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
  607. SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
  608. InHouse[playerid] = 1;
  609. //format(string, sizeof(string), "== Willkommen im Haus %s von %s (/househelp)", dini_Get(HouseFile(houseid), "Name"), dini_Get(HouseFile(houseid), "Besitzer"));
  610. //SendPlayerText(playerid, string);
  611. }
  612. }
  613. //GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
  614. //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
  615. //SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
  616. //SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
  617. return 1;
  618. }*/
  619.  
  620. if(strcmp(cmdtext, "/rein", true) == 0)
  621. {
  622. if(!IsPlayerAdmin(playerid)) return SendErrorText(playerid, "SERVER: Du bist kein Administrator!");
  623. new houseid = PlayerParameters[playerid][HouseArea];
  624. if(!IsPlayerInCheckpoint(playerid) || HouseInfo[houseid]!=1) return SendErrorText(playerid, "SERVER: Du musst in einen Haus Checkpoint stehen!");
  625.  
  626. if(IsPlayerInCheckpoint(playerid))
  627. {
  628. GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
  629. SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
  630. SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
  631. SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
  632. InHouse[playerid] = 1;
  633. format(string, sizeof(string), "== Willkommen im Haus %s von %s (/househelp)", dini_Get(HouseFile(houseid), "Name"), dini_Get(HouseFile(houseid), "Besitzer"));
  634. SendPlayerText(playerid, string);
  635. }
  636. //GetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
  637. //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "ix"),dini_Int(HouseFile(houseid), "iy"),dini_Int(HouseFile(houseid), "iz"));
  638. //SetPlayerInterior(playerid, dini_Int(HouseFile(houseid), "InteriorID"));
  639. //SetPlayerVirtualWorld(playerid, dini_Int(HouseFile(houseid), "VirtualWorld"));
  640. return 1;
  641. }
  642.  
  643.  
  644.  
  645. if(strcmp(cmdtext, "/verlassen", true) == 0)
  646. {
  647. //new houseid = PlayerParameters[playerid][HouseArea];
  648.  
  649. if(InHouse[playerid] == 1)
  650. {
  651. InHouse[playerid]=0;
  652. SetPlayerVirtualWorld(playerid, 0);
  653. SetPlayerPos(playerid, hPos[playerid][0], hPos[playerid][1], hPos[playerid][2]);
  654. //SetPlayerPos(playerid, dini_Int(HouseFile(houseid), "x"),dini_Int(HouseFile(houseid), "y"),dini_Int(HouseFile(houseid), "z")+5);
  655. SetPlayerInterior(playerid, 0);
  656. SendClientText(playerid, "== Du hast das Haus verlassen!");
  657. } else {
  658. SendErrorText(playerid, "SERVER: Du bist in keinem Haus!");
  659. }
  660. return 1;
  661. }
  662.  
  663. if(strcmp(cmdtext, "/menu", true) == 0)
  664. {
  665. if(InHouse[playerid] == 1)
  666. {
  667. ShowMenuForPlayer(menu, playerid);
  668. }
  669. else
  670. {
  671. SendErrorText(playerid, "SERVER: Du bist in keinem Haus!");
  672. }
  673. return 1;
  674. }
  675.  
  676. if(strcmp(cmdtext, "/househelp", true) == 0)
  677. {
  678. SendClientMessage(playerid, COLOR_YELLOW,"============== Haushilfe ==============");
  679. SendClientMessage(playerid, COLOR_YELLOW,"== Kaufen: /kaufen, /verkaufen");
  680. SendClientMessage(playerid, COLOR_YELLOW,"== Haus: /betreten, /verlassen, /menu");
  681. SendClientMessage(playerid, COLOR_YELLOW,"=======================================");
  682. return 1;
  683. }
  684.  
  685. return 0;
  686. }
  687.  
  688. public SpawnAtHouse(playerid)
  689. {
  690. if(dini_Int(PlayerFile(playerid), "OwnHaus") == 1)
  691. {
  692. new houseid = dini_Int(PlayerFile(playerid), "Haus");
  693. SetPlayerPos(playerid,dini_Int(HouseFile(houseid), "x"),dini_Int(HouseFile(houseid), "y"),dini_Int(HouseFile(houseid), "z"));
  694. }
  695. return 1;
  696. }
  697.  
  698. public OnPlayerSelectedMenuRow(playerid, row)
  699. {
  700. new Menu:current;
  701. current = GetPlayerMenu(playerid);
  702. if(current == menu)
  703. {
  704. switch(row)
  705. {
  706. case 0:
  707. {
  708. //Essen
  709. new Float:health;
  710. GetPlayerHealth(playerid,health);
  711. SetPlayerHealth(playerid,health+30);
  712. ShowMenuForPlayer(menu,playerid);
  713. }
  714. case 1:
  715. {
  716. //Trinken
  717. new Float:health;
  718. GetPlayerHealth(playerid,health);
  719. SetPlayerHealth(playerid,health+30);
  720. ShowMenuForPlayer(menu,playerid);
  721. }
  722. case 2:
  723. {
  724. //Schutzweste
  725. SetPlayerArmour(playerid, 100.0);
  726. ShowMenuForPlayer(menu,playerid);
  727. }
  728. case 3:
  729. {
  730. //Sawnoff holen
  731. GivePlayerWeapon(playerid, 26, 500);
  732. ShowMenuForPlayer(menu,playerid);
  733. }
  734. case 4:
  735. {
  736. //M4 holen
  737. GivePlayerWeapon(playerid, 31, 500);
  738. ShowMenuForPlayer(menu,playerid);
  739. }
  740. case 5:
  741. {
  742. //Tec9 holen
  743. GivePlayerWeapon(playerid, 32, 500);
  744. ShowMenuForPlayer(menu,playerid);
  745. }
  746. case 6:
  747. {
  748. //Messer holen
  749. GivePlayerWeapon(playerid, 4, 500);
  750. ShowMenuForPlayer(menu,playerid);
  751. }
  752. case 7:
  753. {
  754. //Schließen
  755. HideMenuForPlayer(menu,playerid);
  756. }
  757. }
  758. }
  759. return 1;
  760. }
  761.  
  762. stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  763. {
  764. if(IsPlayerConnected(playerid))
  765. {
  766. new Float:oldposx, Float:oldposy, Float:oldposz;
  767. new Float:tempposx, Float:tempposy, Float:tempposz;
  768. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  769. tempposx = (oldposx -x);
  770. tempposy = (oldposy -y);
  771. tempposz = (oldposz -z);
  772. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  773. {
  774. return 1;
  775. }
  776. }
  777. return 0;
  778. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement