Advertisement
Guest User

Garage system

a guest
Dec 18th, 2012
913
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 17.13 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4. //1643.839843,-1514.819580,13.566620
  5. // id 0 LS Garage
  6.  
  7. #include <a_samp>
  8. #include <YSI\y_ini>
  9. #include <ZCMD>
  10. #include <sscanf2>
  11.  
  12. forward SaveGrage(id);
  13.  
  14. #define SCM SendClientMessage //Saves time
  15. #define BPATH "/Garages/%i.ini" //Defines the path y_ini will use to find the .ini file we need.
  16. #define DIALOG_GARAZA 3123
  17. #define DIALOG_G_IME 3124
  18. //The below colors do not have to be used, but you will need to edit the script if you choose not to use them.
  19. #define NEWBIE_COLOR        0x7DAEFFFF
  20. #define TCOLOR_WHITE        0xFFFFFF00
  21. #define COLOR_GRAD1         0xB4B5B7FF
  22. #define COLOR_GRAD2         0xBFC0C2FF
  23. #define COLOR_GRAD3         0xCBCCCEFF
  24. #define COLOR_GRAD4         0xD8D8D8FF
  25. #define COLOR_GRAD5         0xE3E3E3FF
  26. #define COLOR_GRAD6         0xF0F0F0FF
  27. #define COLOR_FADE1         0xE6E6E6E6
  28. #define COLOR_FADE2         0xC8C8C8C8
  29. #define COLOR_FADE3         0xAAAAAAAA
  30. #define COLOR_FADE4         0x8C8C8C8C
  31. #define COLOR_FADE5         0x6E6E6E6E
  32. #define COLOR_PURPLE        0xC2A2DAAA
  33. #define COLOR_RED           0xAA3333AA
  34. #define COLOR_GREY          0xAFAFAFAA
  35. #define COLOR_GREEN         0x33AA33AA
  36. #define COLOR_BLACK         0x000001FF
  37. #define COLOR_BLUE          0x007BD0FF
  38. #define COLOR_LIGHTORANGE   0xFFA100FF
  39. #define COLOR_FLASH         0xFF000080
  40. #define COLOR_LIGHTRED      0xFF6347AA
  41. #define COLOR_LIGHTBLUE     0x01FCFFC8
  42. #define COLOR_LIGHTGREEN    0x9ACD32AA
  43. #define COLOR_YELLOW        0xFFFF00AA
  44. #define COLOR_LIGHTYELLOW   0xFFFF91FF
  45. #define COLOR_YELLOW2       0xF5DEB3AA
  46. #define COLOR_WHITE         0xFFFFFFAA
  47.  
  48.  
  49.  
  50. enum gInfo {
  51.     gOwned,
  52.     gPrice,
  53.     gOwner[MAX_PLAYER_NAME],
  54.     gType,
  55.     gLocked,
  56.     gMoney,
  57.     Float:gEntranceX,
  58.     Float:gEntranceY,
  59.     Float:gEntranceZ,
  60.     Float:gEntranceA,
  61.     Float:gExitX,
  62.     Float:gExitY,
  63.     Float:gExitZ,
  64.     Float:gExitA,
  65.     gInt,
  66.     gWorld,
  67.     gInsideInt,
  68.     gInsideWorld,
  69.     gInsideIcon,
  70.     gOutsideIcon,
  71.     gName[128]
  72. }
  73. new GarageInfo[200][gInfo];
  74. new Text3D:GarageText[200];
  75. new InsideGarage[MAX_PLAYERS];
  76.  
  77. stock SledecaGarazaID()
  78. {
  79. new
  80. firma[64];
  81. for(new f = 1; f<= 200; f++)
  82. {
  83. format(firma, sizeof(firma), "/Garages/%i.ini", f);
  84. if(!fexist(firma)) return f;
  85. }
  86. return true;
  87. }
  88.  
  89. public SaveGrage(id)
  90. {
  91.     new file4[40];
  92.     format(file4, sizeof(file4), BPATH, id);
  93.     new INI:File = INI_Open(file4);
  94.     INI_SetTag(File,"data");
  95.     INI_WriteInt(File,"gOwned", GarageInfo[id][gOwned]);
  96.     INI_WriteInt(File,"gPrice", GarageInfo[id][gPrice]);
  97.     INI_WriteString(File,"gOwner", GarageInfo[id][gOwner]);
  98.     INI_WriteInt(File,"gType", GarageInfo[id][gType]);
  99.     INI_WriteInt(File,"gLocked", GarageInfo[id][gLocked]);
  100.     INI_WriteInt(File,"gMoney", GarageInfo[id][gMoney]);
  101.     INI_WriteFloat(File,"gEntranceX", GarageInfo[id][gEntranceX]);
  102.     INI_WriteFloat(File,"gEntranceY", GarageInfo[id][gEntranceY]);
  103.     INI_WriteFloat(File,"gEntranceZ", GarageInfo[id][gEntranceZ]);
  104.     INI_WriteFloat(File,"gEntranceA", GarageInfo[id][gEntranceA]);
  105.     INI_WriteFloat(File,"gExitX", GarageInfo[id][gExitX]);
  106.     INI_WriteFloat(File,"gExitY", GarageInfo[id][gExitY]);
  107.     INI_WriteFloat(File,"gExitZ", GarageInfo[id][gExitZ]);
  108.     INI_WriteFloat(File,"gExitA", GarageInfo[id][gExitA]);
  109.     INI_WriteInt(File,"gInt", GarageInfo[id][gInt]);
  110.     INI_WriteInt(File,"gWorld", GarageInfo[id][gWorld]);
  111.     INI_WriteInt(File,"gInsideInt", GarageInfo[id][gInsideInt]);
  112.     INI_WriteInt(File,"gInsideWorld", GarageInfo[id][gInsideWorld]);
  113.     INI_WriteString(File,"gName", GarageInfo[id][gName]);
  114.     INI_Close(File);
  115.     return 1;
  116. }
  117. forward loadgarage_data(idx, name[], value[]);
  118. public loadgarage_data(idx, name[], value[])
  119. {
  120.     INI_Int("gOwned", GarageInfo[idx][gOwned]);
  121.     INI_Int("gPrice", GarageInfo[idx][gPrice]);
  122.     INI_String("gOwner", GarageInfo[idx][gOwner], 24);
  123.     INI_Int("gType", GarageInfo[idx][gType]);
  124.     INI_Int("gLocked", GarageInfo[idx][gLocked]);
  125.     INI_Int("gMoney", GarageInfo[idx][gMoney]);
  126.     INI_Float("gEntranceX", GarageInfo[idx][gEntranceX]);
  127.     INI_Float("gEntranceY", GarageInfo[idx][gEntranceY]);
  128.     INI_Float("gEntranceZ", GarageInfo[idx][gEntranceZ]);
  129.     INI_Float("gEntranceA", GarageInfo[idx][gEntranceA]);
  130.     INI_Float("gExitX", GarageInfo[idx][gExitX]);
  131.     INI_Float("gExitY", GarageInfo[idx][gExitY]);
  132.     INI_Float("gExitZ", GarageInfo[idx][gExitZ]);
  133.     INI_Float("gExitA", GarageInfo[idx][gExitA]);
  134.     INI_Int("gInt", GarageInfo[idx][gInt]);
  135.     INI_Int("gWorld", GarageInfo[idx][gWorld]);
  136.     INI_Int("gInsideInt", GarageInfo[idx][gInsideInt]);
  137.     INI_Int("gInsideWorld", GarageInfo[idx][gInsideWorld]);
  138.     INI_String("gName", GarageInfo[idx][gName], 128);
  139.     return 1;
  140. }
  141.  
  142.  
  143. public OnFilterScriptInit()
  144. {
  145.     print("\n--------------------------------------");
  146.     print(" Blank Filterscript by your name here");
  147.     print("--------------------------------------\n");
  148.     OnGameModeInit();
  149.     return 1;
  150. }
  151.  
  152. public OnFilterScriptExit()
  153. {
  154.     OnGameModeExit();
  155.     return 1;
  156. }
  157.  
  158.  
  159.  
  160. public OnGameModeInit()
  161. {
  162.  
  163.  
  164. new str[128];
  165. for(new idx = 1; idx < sizeof(GarageInfo); idx++)
  166. {
  167. format(str, sizeof(str), BPATH, idx);
  168. INI_ParseFile(str, "loadgarage_%s", .bExtra = true, .extra = idx );
  169. if(GarageInfo[idx][gOwned] == 0)
  170. {
  171.  
  172. format(str, sizeof(str), "{00CED1}Garaza %s\nVlasnik: Drzava\nCena: %d\n/kupigarazu", GarageInfo[idx][gName], GarageInfo[idx][gPrice]);
  173. GarageText[idx] = Create3DTextLabel(str, 0x008080FF, GarageInfo[idx][gEntranceX], GarageInfo[idx][gEntranceY], GarageInfo[idx][gEntranceZ], 40.0, 0, 0);
  174. }
  175. if(GarageInfo[idx][gOwned] == 1)
  176. {
  177.  
  178.  
  179. format(str, sizeof(str), "{00FF22}Garaza %s\nVlasnik: %s\nSpace za ulazak", GarageInfo[idx][gName], GarageInfo[idx][gOwner]);
  180. GarageText[idx] = Create3DTextLabel(str, 0x008080FF, GarageInfo[idx][gEntranceX], GarageInfo[idx][gEntranceY], GarageInfo[idx][gEntranceZ], 40.0, 0, 0);
  181. }
  182.  
  183. }
  184. return 1;
  185. }
  186.  
  187. public OnGameModeExit()
  188. {
  189.     return 1;
  190. }
  191.  
  192. public OnPlayerRequestClass(playerid, classid)
  193. {
  194.  
  195.     return 1;
  196. }
  197.  
  198. public OnPlayerConnect(playerid)
  199. {
  200.     return 1;
  201. }
  202.  
  203. public OnPlayerDisconnect(playerid, reason)
  204. {
  205.     return 1;
  206. }
  207.  
  208. public OnPlayerSpawn(playerid)
  209. {
  210.     return 1;
  211. }
  212.  
  213. public OnPlayerDeath(playerid, killerid, reason)
  214. {
  215.     return 1;
  216. }
  217.  
  218. public OnVehicleSpawn(vehicleid)
  219. {
  220.     return 1;
  221. }
  222.  
  223. public OnVehicleDeath(vehicleid, killerid)
  224. {
  225.     return 1;
  226. }
  227.  
  228. public OnPlayerText(playerid, text[])
  229. {
  230.     return 1;
  231. }
  232.  
  233. public OnPlayerCommandText(playerid, cmdtext[])
  234. {
  235.     return 0;
  236. }
  237.  
  238. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  239. {
  240.     return 1;
  241. }
  242.  
  243. public OnPlayerExitVehicle(playerid, vehicleid)
  244. {
  245.     return 1;
  246. }
  247.  
  248. public OnPlayerStateChange(playerid, newstate, oldstate)
  249. {
  250.     return 1;
  251. }
  252.  
  253. public OnPlayerEnterCheckpoint(playerid)
  254. {
  255.     return 1;
  256. }
  257.  
  258. public OnPlayerLeaveCheckpoint(playerid)
  259. {
  260.     return 1;
  261. }
  262.  
  263. public OnPlayerEnterRaceCheckpoint(playerid)
  264. {
  265.     return 1;
  266. }
  267.  
  268. public OnPlayerLeaveRaceCheckpoint(playerid)
  269. {
  270.     return 1;
  271. }
  272.  
  273. public OnRconCommand(cmd[])
  274. {
  275.     return 1;
  276. }
  277.  
  278. public OnPlayerRequestSpawn(playerid)
  279. {
  280.     return 1;
  281. }
  282.  
  283. public OnObjectMoved(objectid)
  284. {
  285.     return 1;
  286. }
  287.  
  288. public OnPlayerObjectMoved(playerid, objectid)
  289. {
  290.     return 1;
  291. }
  292.  
  293. public OnPlayerPickUpPickup(playerid, pickupid)
  294. {
  295.     return 1;
  296. }
  297.  
  298. public OnVehicleMod(playerid, vehicleid, componentid)
  299. {
  300.     return 1;
  301. }
  302.  
  303. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  304. {
  305.     return 1;
  306. }
  307.  
  308. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  309. {
  310.     return 1;
  311. }
  312.  
  313. public OnPlayerSelectedMenuRow(playerid, row)
  314. {
  315.     return 1;
  316. }
  317.  
  318. public OnPlayerExitedMenu(playerid)
  319. {
  320.     return 1;
  321. }
  322.  
  323. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  324. {
  325.     return 1;
  326. }
  327.  
  328. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  329. {
  330. if(newkeys == KEY_SPRINT)
  331. {
  332.  
  333. if(!IsPlayerInAnyVehicle(playerid))
  334. {
  335. for(new b = 1; b < sizeof(GarageInfo); b++)//Loops through all the businesses.
  336. {
  337. if(IsPlayerInRangeOfPoint(playerid, 1.0, GarageInfo[b][gEntranceX], GarageInfo[b][gEntranceY], GarageInfo[b][gEntranceZ]))//Checks if player is near the entrance.
  338. {
  339. if(GarageInfo[b][gLocked] == 1) return SendClientMessage(playerid, COLOR_GREY, "Ova garaza je zakljucana");//Checks it it is locked/
  340. SetPlayerPos(playerid, GarageInfo[b][gExitX], GarageInfo[b][gExitY], GarageInfo[b][gExitZ]);
  341. SetPlayerFacingAngle(playerid, GarageInfo[b][gExitA]);
  342. SetPlayerVirtualWorld(playerid, GarageInfo[b][gInsideWorld]);
  343. InsideGarage[playerid] = b;
  344. return 1;
  345. }
  346. if(IsPlayerInRangeOfPoint(playerid, 2.0, GarageInfo[b][gExitX], GarageInfo[b][gExitY], GarageInfo[b][gExitZ]) && GetPlayerVirtualWorld(playerid) == GarageInfo[b][gInsideWorld])//Checks if player is in near the exit.
  347. {
  348. SetPlayerPos(playerid, GarageInfo[b][gEntranceX], GarageInfo[b][gEntranceY], GarageInfo[b][gEntranceZ]);
  349. SetPlayerFacingAngle(playerid, GarageInfo[b][gEntranceA]);
  350.  
  351. SetPlayerVirtualWorld(playerid, GarageInfo[b][gWorld]);
  352. InsideGarage[playerid] = 0;
  353. return 1;
  354. }
  355. }
  356. }
  357.  
  358. if(IsPlayerInAnyVehicle(playerid))
  359. {
  360. for(new b = 1; b < sizeof(GarageInfo); b++)//Loops through all the businesses.
  361. {
  362. if(IsPlayerInRangeOfPoint(playerid, 1.0, GarageInfo[b][gEntranceX], GarageInfo[b][gEntranceY], GarageInfo[b][gEntranceZ]))//Checks if player is near the entrance.
  363. {
  364. if(GarageInfo[b][gLocked] == 1) return SendClientMessage(playerid, COLOR_GREY, "Ova garaza je zakljucana");//Checks it it is locked/
  365. SetVehiclePos(GetPlayerVehicleID(playerid), GarageInfo[b][gExitX], GarageInfo[b][gExitY], GarageInfo[b][gExitZ]);
  366. SetVehicleZAngle(GetPlayerVehicleID(playerid), GarageInfo[b][gExitA]);
  367. SetPlayerVirtualWorld(playerid, GarageInfo[b][gInsideWorld]);
  368. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GarageInfo[b][gInsideWorld]);
  369. InsideGarage[playerid] = b;
  370. return 1;
  371. }
  372. if(IsPlayerInRangeOfPoint(playerid, 2.0, GarageInfo[b][gExitX], GarageInfo[b][gExitY], GarageInfo[b][gExitZ]) && GetPlayerVirtualWorld(playerid) == GarageInfo[b][gInsideWorld])//Checks if player is in near the exit.
  373. {
  374. SetVehiclePos(GetPlayerVehicleID(playerid), GarageInfo[b][gEntranceX], GarageInfo[b][gEntranceY], GarageInfo[b][gEntranceZ]);
  375. SetVehicleZAngle(GetPlayerVehicleID(playerid), GarageInfo[b][gEntranceA]);
  376. SetPlayerVirtualWorld(playerid, GarageInfo[b][gWorld]);
  377. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GarageInfo[b][gWorld]);
  378. InsideGarage[playerid] = 0;
  379. return 1;
  380. }
  381. }
  382. }
  383.  
  384.  
  385.  
  386. }
  387.  
  388. return 1;
  389. }
  390.  
  391. public OnRconLoginAttempt(ip[], password[], success)
  392. {
  393.     return 1;
  394. }
  395.  
  396. public OnPlayerUpdate(playerid)
  397. {
  398.     return 1;
  399. }
  400.  
  401. public OnPlayerStreamIn(playerid, forplayerid)
  402. {
  403.     return 1;
  404. }
  405.  
  406. public OnPlayerStreamOut(playerid, forplayerid)
  407. {
  408.     return 1;
  409. }
  410.  
  411. public OnVehicleStreamIn(vehicleid, forplayerid)
  412. {
  413.     return 1;
  414. }
  415.  
  416. public OnVehicleStreamOut(vehicleid, forplayerid)
  417. {
  418.     return 1;
  419. }
  420.  
  421. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  422. {
  423. switch(dialogid)
  424. {
  425. case DIALOG_G_IME:
  426. {
  427. if(response)
  428. {
  429. new imeu[128];
  430. if(sscanf(inputtext, "s[128]", imeu)) return ShowPlayerDialog(playerid, DIALOG_G_IME, DIALOG_STYLE_INPUT, "Garaza", "Promeni novo ime", "Promeni", "Odustani");
  431. for(new id = 1;id <= sizeof(GarageInfo); id++)
  432. {
  433. new ime[MAX_PLAYER_NAME];
  434. GetPlayerName(playerid, ime, 24);
  435. if(strcmp(GarageInfo[id][gOwner],ime, false ) == 0)
  436. {
  437. strmid(GarageInfo[id][gName], imeu, 0, strlen(imeu), 255);
  438. new str[128];
  439. format(str, sizeof(str), "{00FF22}Garaza %s\nVlasnik: %s\nSpace za ulazak", GarageInfo[id][gName], GarageInfo[id][gOwner]);
  440. Update3DTextLabelText(GarageText[id],-1,str);
  441. }
  442. }
  443.  
  444. }
  445. }
  446. }
  447.  
  448. if(dialogid == DIALOG_GARAZA)
  449. {
  450. if(response)
  451. {
  452. if(listitem == 0)
  453. {
  454. ShowPlayerDialog(playerid, DIALOG_G_IME, DIALOG_STYLE_INPUT, "Garaza", "Promeni novo ime", "Promeni", "Odustani");
  455. }
  456. if(listitem == 1)
  457. {
  458. for(new id = 1;id <= sizeof(GarageInfo); id++)
  459. {
  460. new ime[MAX_PLAYER_NAME];
  461. GetPlayerName(playerid, ime, 24);
  462. if(strcmp(GarageInfo[id][gOwner],ime, false ) == 0)
  463. {
  464. GarageInfo[id][gOwned] = 0;
  465. strmid(GarageInfo[id][gOwner], "Niko", 0, strlen("Niko"), 255);
  466. //\n/kupigarazu
  467. new str[128];
  468. format(str, sizeof(str), "{00CED1}Garaza %s\nVlasnik: Drzava\nCena: %d\n/kupigarazu", GarageInfo[id][gName], GarageInfo[id][gPrice]);
  469. Update3DTextLabelText(GarageText[id],-1,str);
  470. GivePlayerMoney(playerid, GarageInfo[id][gPrice]);
  471. SCM(playerid, -1, "Prodali ste garazu");
  472. if(GarageInfo[id][gPrice] == 0) break;
  473. SaveGrage(id);
  474. }
  475. }
  476. }
  477.  
  478. if(listitem == 2)
  479. {
  480. for(new id = 1;id <= sizeof(GarageInfo); id++)
  481. {
  482. new ime[MAX_PLAYER_NAME];
  483. GetPlayerName(playerid, ime, 24);
  484. if(strcmp(GarageInfo[id][gOwner],ime, false ) == 0)
  485. {
  486. GarageInfo[id][gLocked] = 1;
  487. SCM(playerid, -1, "Zakljuco si garazu");
  488.  
  489. if(GarageInfo[id][gPrice] == 0) break;
  490. SaveGrage(id);
  491. }
  492. }
  493. }
  494. if(listitem == 3)
  495. {
  496. for(new id = 1;id <= sizeof(GarageInfo); id++)
  497. {
  498. new ime[MAX_PLAYER_NAME];
  499. GetPlayerName(playerid, ime, 24);
  500. if(strcmp(GarageInfo[id][gOwner],ime, false ) == 0)
  501. {
  502. GarageInfo[id][gLocked] = 0;
  503. SCM(playerid, -1, "Otkljuco si garazu");
  504.  
  505. if(GarageInfo[id][gPrice] == 0) break;
  506. SaveGrage(id);
  507. }
  508. }
  509. }
  510.  
  511.  
  512. }
  513. }
  514.  
  515.  
  516. return 1;
  517. }
  518.  
  519. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  520. {
  521.     return 1;
  522. }
  523. CMD:napravigarazu(playerid, params[])
  524. {
  525. if(!IsPlayerAdmin(playerid)) return SCM(playerid, COLOR_GREY, "Niste ovlasteni");
  526. new cena;
  527. if(sscanf(params, "i", cena)) return SCM(playerid, COLOR_WHITE, "/napravigarazu [Cena]");
  528. new Float:Pos[3];
  529. new world;
  530. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  531. world = GetPlayerVirtualWorld(playerid);
  532. new Float: A;
  533. GetPlayerFacingAngle(playerid, A);
  534. new int = GetPlayerInterior(playerid);
  535. new id = SledecaGarazaID();
  536. GarageInfo[id][gInsideInt] = 0;
  537. GarageInfo[id][gExitX] = 1643.839843;
  538. GarageInfo[id][gExitY] = -1514.819580;
  539. GarageInfo[id][gExitZ] = 13.566620;
  540.  
  541.  
  542.  
  543. GarageInfo[id][gOwned] = 0;
  544. GarageInfo[id][gPrice] = cena;
  545. GarageInfo[id][gType] = 4;
  546. GarageInfo[id][gEntranceX] = Pos[0];
  547. GarageInfo[id][gEntranceY] = Pos[1];
  548. GarageInfo[id][gEntranceZ] = Pos[2];
  549. GarageInfo[id][gEntranceA] = 180;
  550. GarageInfo[id][gLocked] = 1;
  551.  
  552. GarageInfo[id][gInt] = int;
  553. GarageInfo[id][gWorld] =world;
  554. GarageInfo[id][gInsideWorld] = id;
  555.  
  556. new string[30];
  557. format(string, sizeof(string), "None");
  558. strmid(GarageInfo[id][gName], string, 0, strlen(string), 255);
  559.  
  560. new str1[30];
  561. format(str1, sizeof(str1), "Niko");
  562. strmid(GarageInfo[id][gOwner], str1, 0, strlen(str1), 255);
  563.  
  564. new str[128];
  565. format(str, sizeof(str), "{00CED1}Garaza %s\nVlasnik: Drzava\nCena: %d\n/kupigarazu", GarageInfo[id][gName], GarageInfo[id][gPrice]);
  566. GarageText[id] = Create3DTextLabel(str, 0x008080FF, GarageInfo[id][gEntranceX], GarageInfo[id][gEntranceY], GarageInfo[id][gEntranceZ], 40.0, 0, 0);
  567.  
  568. new file4[40];
  569. format(file4, sizeof(file4), BPATH, id);
  570. new INI:File = INI_Open(file4);
  571. INI_SetTag(File,"data");
  572. INI_WriteInt(File,"gOwned", GarageInfo[id][gOwned]);
  573. INI_WriteInt(File,"gPrice", GarageInfo[id][gPrice]);
  574. INI_WriteString(File,"gOwner", GarageInfo[id][gOwner]);
  575. INI_WriteInt(File,"gType", GarageInfo[id][gType]);
  576. INI_WriteInt(File,"gLocked", GarageInfo[id][gLocked]);
  577. INI_WriteInt(File,"gMoney", GarageInfo[id][gMoney]);
  578. INI_WriteFloat(File,"gEntranceX", GarageInfo[id][gEntranceX]);
  579. INI_WriteFloat(File,"gEntranceY", GarageInfo[id][gEntranceY]);
  580. INI_WriteFloat(File,"gEntranceZ", GarageInfo[id][gEntranceZ]);
  581. INI_WriteFloat(File,"gEntranceA", GarageInfo[id][gEntranceA]);
  582. INI_WriteFloat(File,"gExitX", GarageInfo[id][gExitX]);
  583. INI_WriteFloat(File,"gExitY", GarageInfo[id][gExitY]);
  584. INI_WriteFloat(File,"gExitZ", GarageInfo[id][gExitZ]);
  585. INI_WriteFloat(File,"gExitA", GarageInfo[id][gExitA]);
  586. INI_WriteInt(File,"gInt", GarageInfo[id][gInt]);
  587. INI_WriteInt(File,"gWorld", GarageInfo[id][gWorld]);
  588. INI_WriteInt(File,"gInsideInt", GarageInfo[id][gInsideInt]);
  589. INI_WriteInt(File,"gInsideWorld", GarageInfo[id][gInsideWorld]);
  590. INI_WriteString(File,"gName", GarageInfo[id][gName]);
  591. INI_Close(File);
  592.  
  593.  
  594.  
  595. return 1;
  596. }
  597. CMD:kupigarazu(playerid, params[])
  598. {
  599. for(new id=1;id <= sizeof(GarageInfo);id++)
  600. {
  601. new ime[MAX_PLAYER_NAME];
  602. GetPlayerName(playerid, ime, 24);
  603. if(strcmp(GarageInfo[id][gOwner],ime, true ) == 0) return 0;
  604. if(IsPlayerInRangeOfPoint(playerid, 3.0, GarageInfo[id][gEntranceX], GarageInfo[id][gEntranceY], GarageInfo[id][gEntranceZ]))
  605. {
  606. if(GetPlayerMoney(playerid) < GarageInfo[id][gPrice]) return SCM(playerid, -1, "Nemate dovoljno novca");
  607. GivePlayerMoney(playerid, -GarageInfo[id][gPrice]);
  608. strmid(GarageInfo[id][gOwner], ime, 0, strlen(ime), 255);
  609. GarageInfo[id][gOwned] = 1;
  610. SCM(playerid, -1, "Kupili ste garazu, koristite /garaza za ostalu pomoc");
  611. new str[128];
  612. format(str, sizeof(str), "{00FF22}Garaza %s\nVlasnik: %s\nSpace za ulazak", GarageInfo[id][gName], GarageInfo[id][gOwner]);
  613. Update3DTextLabelText(GarageText[id],-1,str);
  614. }
  615. }
  616. return 1;
  617. }
  618. CMD:garaza(playerid, params[])
  619. {
  620. for(new id = 1;id <= sizeof(GarageInfo); id++)
  621. {
  622. if(IsPlayerInRangeOfPoint(playerid, 30.0, GarageInfo[id][gEntranceX], GarageInfo[id][gEntranceY], GarageInfo[id][gEntranceZ]))
  623. {
  624. new ime[MAX_PLAYER_NAME];
  625. GetPlayerName(playerid, ime, 24);
  626. if(strcmp(GarageInfo[id][gOwner],ime, false ) == 0)
  627. {
  628. ShowPlayerDialog(playerid, DIALOG_GARAZA, DIALOG_STYLE_LIST, "Garaza", "Ime\nProdaj drzavi\nZakljucaj\nOtkljucaj", "Odaberi", "Odustani");
  629. }
  630. }
  631. }
  632. return 1;
  633. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement