Guest User

Untitled

a guest
Jun 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.48 KB | None | 0 0
  1. #include <a_samp>
  2. #include <a_players>
  3. #include <Dini>
  4. #include <streamer>
  5. #include <zcmd>
  6. #include <sscanf2>
  7.  
  8. #define MAX_HOUSES 200
  9.  
  10. #define COLOR_WHITE 0xFFFFFFAA //White color
  11. #define COLOR_RED 0xFF0000AA //Red Color
  12. #define COLOR_GREEN 0x00FF00AA //Green color
  13.  
  14. enum hInfo
  15. {
  16. Float:hEnterX, //Entrance X. It's an float! example: 0.0000000. I'm gonna use the same with the other entrances/exits
  17. Float:hEnterY,
  18. Float:hEnterZ,
  19. Float:hExitX,
  20. Float:hExitY,
  21. Float:hExitZ,
  22. hInsideInt, //The inside interior.. DUH!
  23. hInsideVir, //Already subscribed above
  24. hOutsideInt,
  25. hOutsideVir,
  26. bool:hOwned, //boolean! Is house owned? NO = False, YES = True
  27. hOwner[MAX_PLAYER_NAME], //The house owner! I'm gonna use MAX_PLAYER_NAME, because a player can't have a longer name :')
  28. hPrice, //Will store the price
  29. hPickup, //The pickup. This is used to remove/move the pickup icon!
  30. hIcon, //The map icon. Also used to remove/move it! We are going to need an ID. Without an ID we can't do NOTHING!
  31. h3D,
  32. };
  33.  
  34.  
  35. new HouseInfo[MAX_HOUSES][hInfo];
  36.  
  37.  
  38. stock LoadHouse(houseid)
  39. {
  40. new fstring[10]; //The string for the file [format]
  41. format(fstring, 10, "Houses/%d", houseid); //Format the filename
  42. if(!dini_Exists(fstring)) return 0; //"If Houses/{houseid} not exists then return False (0)"
  43.  
  44. HouseInfo[houseid][hEnterX] = dini_Float(fstring, "EnterX");
  45. HouseInfo[houseid][hEnterY] = dini_Float(fstring, "EnterY");
  46. HouseInfo[houseid][hEnterZ] = dini_Float(fstring, "EnterZ");
  47. HouseInfo[houseid][hExitX] = dini_Float(fstring, "ExitX");
  48. HouseInfo[houseid][hExitY] = dini_Float(fstring, "ExitY");
  49. HouseInfo[houseid][hExitZ] = dini_Float(fstring, "ExitZ");
  50. HouseInfo[houseid][hInsideInt] = dini_Int(fstring, "InsideInt");
  51. HouseInfo[houseid][hInsideVir] = dini_Int(fstring, "InsideVir");
  52. HouseInfo[houseid][hOutsideInt] = dini_Int(fstring, "OutsideInt");
  53. HouseInfo[houseid][hOutsideVir] = dini_Int(fstring, "OutsideVir");
  54. HouseInfo[houseid][hOwned] = dini_Bool(fstring, "Owned") ? true : false; //Because it is an boolean: ? true : false;
  55. // strmid(HouseInfo[houseid][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get("Owner"))); //Used this one instead of {string} = {string}. I've ever read that this is faster
  56. strmid(HouseInfo[houseid][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get(fstring, "Owner")));
  57. HouseInfo[houseid][hPrice] = dini_Int(fstring, "Price");
  58.  
  59. return 1;
  60. }
  61.  
  62. stock LHouse()
  63. {
  64.  
  65. for(new i=0; i<MAX_HOUSES; i++)
  66. {
  67. new fstring[10]; //The string for the file [format]
  68. format(fstring, 10, "Houses/%d", i); //Format the filename
  69. if(!dini_Exists(fstring)) return 0; //"If Houses/{houseid} not exists then return False (0)"
  70.  
  71. HouseInfo[i][hEnterX] = dini_Float(fstring, "EnterX");
  72. HouseInfo[i][hEnterY] = dini_Float(fstring, "EnterY");
  73. HouseInfo[i][hEnterZ] = dini_Float(fstring, "EnterZ");
  74. HouseInfo[i][hExitX] = dini_Float(fstring, "ExitX");
  75. HouseInfo[i][hExitY] = dini_Float(fstring, "ExitY");
  76. HouseInfo[i][hExitZ] = dini_Float(fstring, "ExitZ");
  77. HouseInfo[i][hInsideInt] = dini_Int(fstring, "InsideInt");
  78. HouseInfo[i][hInsideVir] = dini_Int(fstring, "InsideVir");
  79. HouseInfo[i][hOutsideInt] = dini_Int(fstring, "OutsideInt");
  80. HouseInfo[i][hOutsideVir] = dini_Int(fstring, "OutsideVir");
  81. HouseInfo[i][hOwned] = dini_Bool(fstring, "Owned") ? true : false; //Because it is an boolean: ? true : false;
  82. // strmid(HouseInfo[houseid][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get("Owner"))); //Used this one instead of {string} = {string}. I've ever read that this is faster
  83. strmid(HouseInfo[i][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get(fstring, "Owner")));
  84. HouseInfo[i][hPrice] = dini_Int(fstring, "Price");
  85.  
  86. LoadHouseVisual(i, false);
  87. }
  88. return 1;
  89. }
  90. stock LHouse2()
  91. {
  92.  
  93. for(new i=0; i<MAX_HOUSES; i++)
  94. {
  95. new fstring[10]; //The string for the file [format]
  96. format(fstring, 10, "Houses/%d", i); //Format the filename
  97. if(!dini_Exists(fstring)) return 0; //"If Houses/{houseid} not exists then return False (0)"
  98.  
  99. HouseInfo[i][hEnterX] = dini_Float(fstring, "EnterX");
  100. HouseInfo[i][hEnterY] = dini_Float(fstring, "EnterY");
  101. HouseInfo[i][hEnterZ] = dini_Float(fstring, "EnterZ");
  102. HouseInfo[i][hExitX] = dini_Float(fstring, "ExitX");
  103. HouseInfo[i][hExitY] = dini_Float(fstring, "ExitY");
  104. HouseInfo[i][hExitZ] = dini_Float(fstring, "ExitZ");
  105. HouseInfo[i][hInsideInt] = dini_Int(fstring, "InsideInt");
  106. HouseInfo[i][hInsideVir] = dini_Int(fstring, "InsideVir");
  107. HouseInfo[i][hOutsideInt] = dini_Int(fstring, "OutsideInt");
  108. HouseInfo[i][hOutsideVir] = dini_Int(fstring, "OutsideVir");
  109. HouseInfo[i][hOwned] = dini_Bool(fstring, "Owned") ? true : false; //Because it is an boolean: ? true : false;
  110. // strmid(HouseInfo[houseid][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get("Owner"))); //Used this one instead of {string} = {string}. I've ever read that this is faster
  111. strmid(HouseInfo[i][hOwner], dini_Get(fstring, "Owner"), 0, false, strlen(dini_Get(fstring, "Owner")));
  112. HouseInfo[i][hPrice] = dini_Int(fstring, "Price");
  113.  
  114. LoadHouseVisual(i, true);
  115. }
  116. return 1;
  117. }
  118.  
  119.  
  120. stock LoadHouseVisual(houseid, bool:reload = false)
  121. {
  122. if(reload)
  123.  
  124. {
  125. DestroyDynamicMapIcon(HouseInfo[houseid][hIcon]);
  126. DestroyDynamicPickup(HouseInfo[houseid][hPickup]);
  127. Delete3DTextLabel(HouseInfo[houseid][h3D]); // tu pierwszy warning 213: tag mismatch
  128. }
  129.  
  130. if(!HouseInfo[houseid][hOwned]) //Also known as 'if(HouseInfo[houseid][hOwned] == false)' - With aan boolean you can use '!{option}' and "{option}"! (!IsPlayerAdmin())) (IsPlayerAdmin())
  131. {
  132. //So the house is not owned. Let's make an green mapicon and en green house pickup!
  133. new string[128];
  134. format(string, 128, "Dom %s\nID; %d\n Cena: %d", HouseInfo[houseid][hOwner], houseid, HouseInfo[houseid][hPrice]);
  135.  
  136. HouseInfo[houseid][h3D] = Create3DTextLabel( string, 0x008080FF, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 30.0, 0, 0); // tu 2
  137.  
  138. HouseInfo[houseid][hIcon] = CreateDynamicMapIcon(HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 31, 0, HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
  139. HouseInfo[houseid][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
  140. }
  141. else
  142. {
  143. //House is already owned. Blue pickup and red icon!
  144. HouseInfo[houseid][hIcon] = CreateDynamicMapIcon(HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 31, 0, HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
  145. HouseInfo[houseid][hPickup] = CreateDynamicPickup(1272, 1, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], HouseInfo[houseid][hOutsideVir], HouseInfo[houseid][hOutsideInt]);
  146. new string[128]; //
  147. format(string, 128, "Dom gracza: %s\nID; %d", HouseInfo[houseid][hOwner], houseid ); //Format the filename
  148. HouseInfo[houseid][h3D] = Create3DTextLabel( string, 0x008080FF, HouseInfo[houseid][hEnterX], HouseInfo[houseid][hEnterY], HouseInfo[houseid][hEnterZ], 30.0, 0, 0); // tu 3
  149.  
  150.  
  151. }
  152.  
  153.  
  154. // return 0;
  155. }
  156.  
  157. stock SaveHouse(houseid)
  158. {
  159. new fstring[10]; //The string for the file [format]
  160. format(fstring, 10, "Houses/%d", houseid); //Format the filename
  161.  
  162. dini_Create(fstring);//tworzy plik
  163. dini_FloatSet(fstring, "EnterX", HouseInfo[houseid][hEnterX]);
  164. dini_FloatSet(fstring, "EnterY", HouseInfo[houseid][hEnterY]);
  165. dini_FloatSet(fstring, "EnterZ", HouseInfo[houseid][hEnterZ]);
  166. dini_FloatSet(fstring, "ExitX", HouseInfo[houseid][hExitX]);
  167. dini_FloatSet(fstring, "ExitY", HouseInfo[houseid][hExitY]);
  168. dini_FloatSet(fstring, "ExitZ", HouseInfo[houseid][hExitZ]);
  169. dini_IntSet(fstring, "InsideInt", HouseInfo[houseid][hInsideInt]);
  170. dini_IntSet(fstring, "InsideVir", HouseInfo[houseid][hInsideVir]);
  171. dini_IntSet(fstring, "OutsideInt", HouseInfo[houseid][hOutsideInt]);
  172. dini_IntSet(fstring, "OutsideVir", HouseInfo[houseid][hOutsideVir]);
  173. dini_BoolSet(fstring, "Owned", HouseInfo[houseid][hOwned]);
  174. // dini_Set(fstring, "Owner", HouseInfo[houseid][hOwner]), strmid(HouseInfo[houseid][hOwner], "Na sprzedaz", 0, false, 8); //Set the owner of the house to "For Sale" //No, not "GetSet"! :P
  175. // dini_Set(fstring, "Owner", HouseInfo[houseid][hOwner]), 0, false, strlen(dini_Set(fstring, "Owner", HouseInfo[houseid][hOwner]));
  176. dini_Set(fstring, "Owner", "Na Sprzedaz"); //No, not "GetSet"! :P
  177. dini_IntSet(fstring, "Price", HouseInfo[houseid][hPrice]);
  178. }
  179.  
  180. public OnFilterScriptInit()
  181. {
  182. print("\n--------------------------------------");
  183. print(" Domy zaladowane ");
  184. print("--------------------------------------\n");
  185.  
  186. SetTimer("UpdatePlayersHouseInfo", 1000, true); //Every 1000 milli seconds (1 sec.) it will be used again
  187.  
  188. LHouse();
  189. // LHouseVisual(false);
  190.  
  191. return 1;
  192. }
  193.  
  194. public OnFilterScriptExit()
  195. {
  196. return 1;
  197. }
  198.  
  199. forward UpdatePlayersHouseInfo();
  200. public UpdatePlayersHouseInfo()
  201. {
  202. new str[100]; //The string we are gonna format
  203. for(new i = 0; i < MAX_PLAYERS; i++) //Loop through all the players
  204. {
  205. for(new j = 0; j < MAX_HOUSES; j++) //Loop through all the houses
  206. {
  207. if(IsPlayerInRangeOfPoint(j, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(j) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(j) == HouseInfo[i][hOutsideVir]) //You already know this! If you don't know it, do step 3 again!
  208. {
  209. if(HouseInfo[j][hOwned]) //Is house owned?
  210. format(str, 100, "~w~Dom gracza ~r~%s", HouseInfo[j][hOwner]); //Will give: {white_color}House owned by {yellow_color}OWNER
  211. else //House isn't owned
  212. format(str, 100, "~w~Dom na sprzedaz!~n~Cena: ~g~$%d,-", HouseInfo[j][hPrice]); //Will give: {white_color}House for sale!{new line}Price: {green_color}$PRICE
  213. GameTextForPlayer(i, str, 2000, 3); //Show the text 2 seconds!
  214. }
  215. }
  216. }
  217. return 1;
  218. }
  219.  
  220. /*
  221. public OnPlayerRequestClass(playerid, classid)
  222. {
  223. SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
  224. SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
  225. SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
  226. return 1;
  227. }
  228. */
  229. public OnPlayerConnect(playerid)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnPlayerDisconnect(playerid, reason)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnPlayerSpawn(playerid)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnPlayerDeath(playerid, killerid, reason)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnVehicleSpawn(vehicleid)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnVehicleDeath(vehicleid, killerid)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnPlayerText(playerid, text[])
  260. {
  261. return 1;
  262. }
  263.  
  264. CMD:komenda(playerid, params[])
  265. {
  266. //zrob cos tutaj
  267. }
  268.  
  269. CMD:ladujdomy(playerid, params[])
  270. {
  271. LHouse2();
  272. }
  273.  
  274. CMD:domypomoc(playerid, params[])
  275. {
  276. SendClientMessage(playerid, COLOR_GREEN, "Dom kupiony!"); //Send the player an message.
  277. return 1;
  278. }
  279.  
  280. CMD:createhouse(playerid, params[])
  281. {
  282. new Float:X, Float:Y, Float:Z;
  283. GetPlayerPos(playerid, X, Y, Z);
  284.  
  285.  
  286. for(new i=0; i<MAX_HOUSES; i++)
  287. {
  288. new fstring[10]; //The string for the file [format]
  289. format(fstring, 10, "Houses/%d", i); //Format the filename
  290.  
  291. if(!dini_Exists(fstring))
  292. {
  293. i = i++;
  294. new hi = i + 10;
  295.  
  296. HouseInfo[i][hEnterX] = X;
  297. HouseInfo[i][hEnterY] = Y;
  298. HouseInfo[i][hEnterZ] = Z;
  299. HouseInfo[i][hExitX] = 2496.049804;
  300. HouseInfo[i][hExitY] = -1695.238159;
  301. HouseInfo[i][hExitZ] = 1014.742187;
  302. HouseInfo[i][hInsideInt] = 3;
  303. HouseInfo[i][hInsideVir] = hi;
  304. HouseInfo[i][hOutsideInt] = 0;
  305. HouseInfo[i][hOutsideVir] = 0;
  306. HouseInfo[i][hOwned] = false;
  307. strmid(HouseInfo[i][hOwner], "Na sprzedaz", 0, false, 8); //Set the owner of the house to "For Sale"
  308. HouseInfo[i][hPrice] = 1000;
  309.  
  310. SaveHouse(i);
  311. LoadHouseVisual(i, true);
  312. UpdatePlayersHouseInfo();
  313. LoadHouse(i);
  314.  
  315. /*
  316. dini_FloatSet(fstring, "EnterX", HouseInfo[i][hEnterX]);
  317. dini_FloatSet(fstring, "EnterY", HouseInfo[i][hEnterY]);
  318. dini_FloatSet(fstring, "EnterZ", HouseInfo[i][hEnterZ]);
  319. dini_FloatSet(fstring, "ExitX", HouseInfo[i][hExitX]);
  320. dini_FloatSet(fstring, "ExitY", HouseInfo[i][hExitY]);
  321. dini_FloatSet(fstring, "ExitZ", HouseInfo[i][hExitZ]);
  322. dini_IntSet(fstring, "InsideInt", HouseInfo[i][hInsideInt]);
  323. dini_IntSet(fstring, "InsideVir", HouseInfo[i][hInsideVir]);
  324. dini_IntSet(fstring, "OutsideInt", HouseInfo[i][hOutsideInt]);
  325. dini_IntSet(fstring, "OutsideVir", HouseInfo[i][hOutsideVir]);
  326. dini_BoolSet(fstring, "Owned", HouseInfo[i][hOwned]);
  327. dini_Set(fstring, "Owner", HouseInfo[i][hOwner]); //No, not "GetSet"! :P
  328. dini_IntSet(fstring, "Price", HouseInfo[i][hPrice]);
  329. */
  330. break; //<-- kończy pętle poto aby zrobiło tylko jeden domek :D
  331. }
  332. }
  333.  
  334. return 1;
  335. }
  336.  
  337.  
  338.  
  339. CMD:buyhouse(playerid, params[])
  340. {
  341. new pName[MAX_PLAYER_NAME]; //For the player's name - For the house
  342. GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //Get the name of the player and store it in [u]pName[/u]
  343. for(new i = 0; i < MAX_HOUSES; i++) //Last time I'm gonna say it: Loop through all the houses
  344. {
  345. if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir]) //Is player near house entrance, and if player is in interior of that house + virtual world (Last time I said this too!)
  346. {
  347. if(HouseInfo[i][hOwned]) return SendClientMessage(playerid, COLOR_RED, "Ten dom ma juz wlasciciela!"); //Is the house owned? Then send message that it's owned and stop.
  348. if(GetPlayerMoney(playerid) < HouseInfo[i][hPrice]) return SendClientMessage(playerid, COLOR_RED, "Nie masz wystarczajacej ilosci pieniedzy!"); //Has player too less money? Send him a message!
  349.  
  350. HouseInfo[i][hOwned] = true; //The house is owned, where the player used /buyhouse
  351. strmid(HouseInfo[i][hOwner], pName, 0, false, strlen(pName)); //Put the players name into the "hOwner" of the house
  352. GivePlayerMoney(playerid, -HouseInfo[i][hPrice]); //Remove some money of the player.. The value of the house
  353. SendClientMessage(playerid, COLOR_GREEN, "Dom kupiony!"); //Send the player an message.
  354. SaveHouse(i);
  355. LoadHouseVisual(i, true); //Load House Visual. Now, I've added ', true': It will RELOAD now!
  356. return 1;
  357. }
  358. }
  359. return 1;
  360. }
  361.  
  362. CMD:sellhouse(playerid, params[])
  363. {
  364. new pName[MAX_PLAYER_NAME]; //See /buyhouse
  365. GetPlayerName(playerid, pName, MAX_PLAYER_NAME); //See new pName[MAX_PLAYER_NAME];
  366. for(new i = 0; i < MAX_HOUSES; i++)
  367. {
  368. if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir])
  369. {
  370. if(!strcmp(HouseInfo[i][hOwner], pName, false)) //Is the owner of the house the same as the players name (is the player the owner?? !)
  371. {
  372. strmid(HouseInfo[i][hOwner], "Na sprzedaz", 0, false, 8); //Set the owner of the house to "For Sale"
  373. HouseInfo[i][hOwned] = false; //House is not owner anymore!
  374. GivePlayerMoney(playerid, HouseInfo[i][hPrice]/2); //Give the player 50% of the house value back!
  375. SendClientMessage(playerid, COLOR_GREEN, "Dom sprzedany!");
  376. SaveHouse(i);
  377. LoadHouseVisual(i, true); //Load House Visual. Now, I've added ', true': It will RELOAD now!
  378. return 1;
  379. }
  380. }
  381. }
  382. return 1;
  383. }
  384.  
  385.  
  386.  
  387. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  388. {
  389. return 1;
  390. }
  391.  
  392. public OnPlayerExitVehicle(playerid, vehicleid)
  393. {
  394. return 1;
  395. }
  396.  
  397. public OnPlayerStateChange(playerid, newstate, oldstate)
  398. {
  399. return 1;
  400. }
  401.  
  402. public OnPlayerEnterCheckpoint(playerid)
  403. {
  404. return 1;
  405. }
  406.  
  407. public OnPlayerLeaveCheckpoint(playerid)
  408. {
  409. return 1;
  410. }
  411.  
  412. public OnPlayerEnterRaceCheckpoint(playerid)
  413. {
  414. return 1;
  415. }
  416.  
  417. public OnPlayerLeaveRaceCheckpoint(playerid)
  418. {
  419. return 1;
  420. }
  421.  
  422. public OnRconCommand(cmd[])
  423. {
  424. return 1;
  425. }
  426.  
  427. public OnPlayerRequestSpawn(playerid)
  428. {
  429. return 1;
  430. }
  431.  
  432. public OnObjectMoved(objectid)
  433. {
  434. return 1;
  435. }
  436.  
  437. public OnPlayerObjectMoved(playerid, objectid)
  438. {
  439. return 1;
  440. }
  441.  
  442. public OnPlayerPickUpPickup(playerid, pickupid)
  443. {
  444. return 1;
  445. }
  446.  
  447. public OnVehicleMod(playerid, vehicleid, componentid)
  448. {
  449. return 1;
  450. }
  451.  
  452. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  453. {
  454. return 1;
  455. }
  456.  
  457. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  458. {
  459. return 1;
  460. }
  461.  
  462. public OnPlayerSelectedMenuRow(playerid, row)
  463. {
  464. return 1;
  465. }
  466.  
  467. public OnPlayerExitedMenu(playerid)
  468. {
  469. return 1;
  470. }
  471.  
  472. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  473. {
  474. return 1;
  475. }
  476.  
  477. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  478. {
  479. if(newkeys & 16 && !IsPlayerInAnyVehicle(playerid)) //If player pressed ENTER_VEHICLe and if he's not in an vehicle
  480. {
  481. for(new i = 0; i < MAX_HOUSES; i++) //Loop through all the houses
  482. {
  483. if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hOutsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hOutsideVir]) //Is player near house entrance, and if player is in interior of that house + virtual world
  484. {
  485. SetPlayerPos(playerid, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]);
  486. SetPlayerInterior(playerid, HouseInfo[i][hInsideInt]);
  487. SetPlayerVirtualWorld(playerid, HouseInfo[i][hInsideVir]);
  488. //This will put the player IN the house
  489. }
  490. else if(IsPlayerInRangeOfPoint(playerid, 1.5, HouseInfo[i][hExitX], HouseInfo[i][hExitY], HouseInfo[i][hExitZ]) && GetPlayerInterior(playerid) == HouseInfo[i][hInsideInt] && GetPlayerVirtualWorld(playerid) == HouseInfo[i][hInsideVir]) //Same as the previous IsPlayerInRangeOfPoint, but now if the player is near the house exit+int+vir
  491. {
  492. SetPlayerPos(playerid, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ]);
  493. SetPlayerInterior(playerid, HouseInfo[i][hOutsideInt]);
  494. SetPlayerVirtualWorld(playerid, HouseInfo[i][hOutsideVir]);
  495. }
  496. }
  497. }
  498. return 1;
  499. }
  500.  
  501. public OnRconLoginAttempt(ip[], password[], success)
  502. {
  503. return 1;
  504. }
  505.  
  506. public OnPlayerUpdate(playerid)
  507. {
  508. return 1;
  509. }
  510.  
  511. public OnPlayerStreamIn(playerid, forplayerid)
  512. {
  513. return 1;
  514. }
  515.  
  516. public OnPlayerStreamOut(playerid, forplayerid)
  517. {
  518. return 1;
  519. }
  520.  
  521. public OnVehicleStreamIn(vehicleid, forplayerid)
  522. {
  523. return 1;
  524. }
  525.  
  526. public OnVehicleStreamOut(vehicleid, forplayerid)
  527. {
  528. return 1;
  529. }
  530.  
  531. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  532. {
  533. return 1;
  534. }
  535.  
  536. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  537. {
  538. return 1;
  539. }
  540.  
  541. stock IsValidVehicleModel(vehiclemodel)
  542. {
  543. if(vehiclemodel >= 400 && vehiclemodel <= 611)
  544. return true;
  545. return false;
  546. }
Add Comment
Please, Sign In to add comment