Guest User

Untitled

a guest
Jun 9th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.56 KB | None | 0 0
  1.  
  2. /*
  3. Ivex's Multy Vehicle Ownership
  4.  
  5. iVersion 1.1
  6.  
  7. Copyright(c)
  8. */
  9. #include <a_samp>
  10. #include <Dini>
  11. #include <zcmd>
  12. #include <sscanf2>
  13.  
  14. #pragma tabsize 0
  15.  
  16.  
  17. #define COLOR_GREY 0xAFAFAFAA
  18. #define COLOR_GREEN 0x9EC73DAA
  19. #define COLOR_RED 0xAA3333AA
  20. #define COLOR_LIGHTRED 0xFF6347AA
  21. #define COLOR_LIGHTBLUE 0x33CCFFAA
  22. #define COLOR_LIGHTGREEN 0x9ACD32AA
  23. #define COLOR_YELLOW 0xFFFF00AA
  24. #define COLOR_WHITE 0xFFFFFFAA
  25. #define COLOR_MEDIUMAQUA 0x83BFBFAA
  26. #define SCM SendClientMessage
  27. #define SaveFile "V_File.cfg"
  28.  
  29. #define MAX_MYVEHS 50
  30. #define MAX_BUYED_VEHS 2
  31.  
  32.  
  33.  
  34. //============================== VEHICLES ======================================
  35. enum einfo
  36. {
  37. MyVehSlot,
  38. MyVehModel,
  39. Float:MyVehPos[4],
  40. MyVehCol[2],
  41. MyVehLock,
  42. MyVehOwner[MAX_PLAYER_NAME],
  43. MyVehAlarm,
  44. MyVehFsale,
  45. MyVehID,
  46. MyVehCar,
  47. MyVehBike,
  48. MyVehBoat,
  49. MyVehPlane
  50. };
  51. new MyVehicle[MAX_MYVEHS][einfo];
  52.  
  53. new Text:CarShopTextDraw[MAX_PLAYERS];
  54. new IsShoping[MAX_PLAYERS];
  55. new ShopVeh1[4];//0 ID,1 Model,2 col1,3 ol2 car
  56. new ShopVeh2[4];//0 ID,1 Model,2 col1,3 ol2 bike
  57. new VehButtonSet[MAX_PLAYERS][4];
  58. new clx[MAX_PLAYERS] = 0;
  59. new EnCV[MAX_PLAYERS];
  60. new vCars[29][2] =
  61. {
  62. {411,650000},
  63. {415,520000},
  64. {424,380000},
  65. {426,180000},
  66. {429,400000},
  67. {434,540000},
  68. {437,500000},
  69. {444,850000},
  70. {451,750000},
  71. {477,385000},
  72. {480,240000},
  73. {502,600000},
  74. {503,600000},
  75. {506,470000},
  76. {541,489000},
  77. {550,210000},
  78. {555,241000},
  79. {559,390000},
  80. {558,180000},
  81. {560,500000},
  82. {561,150000},
  83. {562,432156},
  84. {565,170000},
  85. {568,200000},
  86. {579,190500},
  87. {587,456456},
  88. {589,100000},
  89. {602,320000},
  90. {603,270000}
  91. };
  92. new vBikes[10][2]={
  93. {581,21000},//BF-400
  94. {462,1000},//Faggio
  95. {521,16000},//FCR-900
  96. {463,25000},//Freeway
  97. {522,45000},//NRG-500
  98. {461,20000},//PCJ-600
  99. {448,1000},//Pizzaboy
  100. {471,5000},//Quad
  101. {468,30000},//Sanchez
  102. {586,30000}//Wayfarer
  103. };
  104.  
  105. new VehNames[212][] = {
  106. "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto",
  107. "Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion",
  108. "Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van",
  109. "Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez","Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR350","Walton","Regina",
  110. "Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson",
  111. "Mesa","RC Goblin","Hotring Racer","Hotring Racer","Bloodring Banger","Rancher","Super GT","Elegant","Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain","Nebula","Majestic","Buccaneer","Shamal",
  112. "Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak","Vortex",
  113. "Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster","Monster","Uranus","Jester",
  114. "Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight","Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley",
  115. "Stafford","BF-400","Newsvan","Tug","Trailer","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer","Trailer","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)","Police Car (LVPD)","Police Ranger",
  116. "Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer","Luggage Trailer","Stair Trailer","Boxville","Farm Plow","Utility Trailer"
  117. };
  118. //==============================================================================
  119.  
  120.  
  121.  
  122. public OnFilterScriptInit()
  123. {
  124. return 1;
  125. }
  126.  
  127. public OnGameModeInit()
  128. {
  129. ShopVeh1[0] = CreateVehicle(vCars[ShopVeh1[1]][0], 1292.0682,-1870.6963,13.3741,358.0040, ShopVeh1[2], ShopVeh1[3], 30000);
  130. ShopVeh2[0] = CreateVehicle(vBikes[ShopVeh2[1]][0],1298.7928,-1870.8855,13.5469,349.0682, ShopVeh2[2], ShopVeh2[3], 30000);
  131. CVozilaTextDraw(); // textdraw
  132. LoadMyVehSystem(); // loadanje lvl 1
  133. print("\n----------------------------------");
  134. print(":::::::::Loading Jake_Ryan's::::::::");
  135. print("----------------------------------\n");
  136. return 1;
  137. }
  138. public OnFilterScriptExit()
  139. {
  140. DVozilaTextDraw();// unistava textdraw
  141. for(new i; i< MAX_MYVEHS;i++)
  142. {
  143. if(MyVehicle[i][MyVehSlot] == 1)
  144. {
  145. DestroyVehicle(MyVehicle[i][MyVehID]);
  146. }
  147. }
  148. print("\n----------------------------------");
  149. print("::::::::Unloading Jake_Ryan's:::::::");
  150. print("----------------------------------\n");
  151. return 1;
  152. }
  153.  
  154.  
  155. main()
  156. {
  157. }
  158.  
  159. public OnPlayerConnect(playerid)
  160. {
  161. EnCV[playerid] = -1;
  162. return 1;
  163. }
  164.  
  165. public OnPlayerDisconnect(playerid,reason)
  166. {
  167. EnCV[playerid] = -1;
  168. return 1;
  169. }
  170.  
  171. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  172. {
  173. new Float:PEnterPos[3][MAX_PLAYERS];
  174. new string[64];
  175. GetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);
  176. if(ConvertVehIDtoDYID(vehicleid) != -1)
  177. {
  178. new i;
  179. i = ConvertVehIDtoDYID(vehicleid);
  180. if(MyVehicle[i][MyVehSlot] == 1 && (MyVehicle[i][MyVehCar] != -1 || MyVehicle[i][MyVehBike] != -1 || MyVehicle[i][MyVehBoat] != -1 || MyVehicle[i][MyVehPlane] != -1) && MyVehicle[i][MyVehFsale] < 1)
  181. {
  182. format(string, sizeof(string), "~g~~h~GAZDA:~w~ %s",MyVehicle[i][MyVehOwner]);
  183. GameTextForPlayer(playerid,string,2000,3);
  184. if(MyVehicle[i][MyVehLock] == 1 && !IsPlayerAdmin(playerid))
  185. {SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);}
  186. }
  187. if(MyVehicle[i][MyVehFsale] > 0)
  188. {
  189. format(string, sizeof(string), "~y~~h~~h~%s~n~~y~~h~SE PRODAVA:~y~ %d$",VehNames[GetVehicleModel(vehicleid) - 400],MyVehicle[i][MyVehFsale]);
  190. GameTextForPlayer(playerid,string,2000,3);
  191. EnCV[playerid] = i;
  192. if(!IsPlayerAdmin(playerid)){SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);}
  193. return 1;
  194. }
  195. }
  196. if(vehicleid == ShopVeh1[0])
  197. {SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);
  198. new cijena;
  199. for(new x; x<29;x++){if(vCars[x][0] == GetVehicleModel(ShopVeh1[0]))cijena = vCars[x][1];}
  200. format(string, sizeof(string), "~y~~h~~h~%s~n~~y~~h~SE PRODAVA:~y~ %d$",VehNames[GetVehicleModel(ShopVeh1[0]) - 400],cijena);
  201. GameTextForPlayer(playerid,string,2000,5);}
  202. if(vehicleid == ShopVeh2[0])
  203. {SetPlayerPos(playerid,PEnterPos[0][playerid],PEnterPos[1][playerid],PEnterPos[2][playerid]);
  204. new cijena;
  205. for(new x; x<10;x++){if(vBikes[x][0] == GetVehicleModel(ShopVeh2[0]))cijena = vBikes[x][1];}
  206. format(string, sizeof(string), "~y~~h~~h~%s~n~~y~~h~SE PRODAVA:~y~ %d$",VehNames[GetVehicleModel(ShopVeh2[0]) - 400],cijena);
  207. GameTextForPlayer(playerid,string,2000,5);}
  208. return 1;
  209. }
  210. public OnVehicleSpawn(vehicleid)
  211. {
  212. if(ConvertVehIDtoDYID(vehicleid) != -1)
  213. {
  214. ChangeVehicleColor(vehicleid, MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][0], MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][1]);
  215. SetVehiclePos(MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehID], MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][0],MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][1],MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][2]);
  216. SetVehicleZAngle(MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehID], MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehPos][3]);
  217. }
  218. return 1;
  219. }
  220. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  221. {
  222. if(ConvertVehIDtoDYID(vehicleid) != -1)
  223. {
  224. MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][0] = color1;
  225. MyVehicle[ConvertVehIDtoDYID(vehicleid)][MyVehCol][1] = color2;
  226. UpdateMyVehSystem(ConvertVehIDtoDYID(vehicleid));
  227. }
  228. return 1;
  229. }
  230.  
  231. public OnPlayerUpdate(playerid)
  232. {
  233. ResetVehButton(playerid);
  234. return 1;
  235. }
  236.  
  237. stock Ime(playerid)
  238. {
  239. new ime[MAX_PLAYER_NAME];
  240. GetPlayerName(playerid, ime, MAX_PLAYER_NAME);
  241. return ime;
  242. }
  243.  
  244. //==========VOZILA := Vozila OWNERSHIP==========================================
  245.  
  246.  
  247. stock CVozilaTextDraw()
  248. {
  249. for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
  250. {CarShopTextDraw[playerid] = TextDrawCreate(295.500000,310.000000,"~y~Ime~n~~n~~h~~h~~b~Cena:------~n~~n~~h~~h~~y~< ~g~Ponatamu ~h~~h~~y~>");
  251. TextDrawAlignment(CarShopTextDraw[playerid],0);
  252. TextDrawBackgroundColor(CarShopTextDraw[playerid],0x000000ff);
  253. TextDrawFont(CarShopTextDraw[playerid],1);
  254. TextDrawLetterSize(CarShopTextDraw[playerid],0.499999,1.000000);
  255. TextDrawColor(CarShopTextDraw[playerid],0xF5DEB3AA);
  256. TextDrawSetOutline(CarShopTextDraw[playerid],1);
  257. TextDrawSetProportional(CarShopTextDraw[playerid],1);
  258. TextDrawSetShadow(CarShopTextDraw[playerid],1);}
  259. }
  260. stock HVozilaTextDraw(playerid)
  261. {TextDrawHideForPlayer(playerid,CarShopTextDraw[playerid]);}
  262. stock SVozilaTextDraw(playerid)
  263. {TextDrawShowForPlayer(playerid,CarShopTextDraw[playerid]);}
  264. stock DVozilaTextDraw()
  265. {for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
  266. {TextDrawDestroy(CarShopTextDraw[playerid]);}}
  267.  
  268. stock ResetVehButton(playerid)
  269. {
  270. if(IsShoping[playerid] > 0)
  271. {
  272. new Keys, ud, lr;
  273. GetPlayerKeys(playerid, Keys, ud, lr);
  274. if(lr > 0) //desno
  275. {VehButtonSet[playerid][0] ++;
  276. VehShopChanger(playerid);}
  277. else if(lr < 0) //lijevo
  278. {VehButtonSet[playerid][1] ++;
  279. VehShopChanger(playerid);}
  280. else if(Keys & KEY_FIRE) //ctrl
  281. {VehButtonSet[playerid][2]++;
  282. VehShopChanger(playerid);}
  283. else if(Keys & KEY_SECONDARY_ATTACK) //enter
  284. {VehButtonSet[playerid][3]++;
  285. VehShopChanger(playerid);}
  286. else
  287. {VehButtonSet[playerid][0] = 0;
  288. VehButtonSet[playerid][1] = 0;
  289. VehButtonSet[playerid][2] = 0;
  290. VehButtonSet[playerid][3] = 0;
  291. VehShopChanger(playerid);}
  292. }
  293. return 0;
  294. }
  295. stock VehShopChanger(playerid)
  296. {
  297. if(IsPlayerConnected(playerid))
  298. {
  299. if(IsShoping[playerid] == 1)
  300. {
  301. new string[128],pa = 0;
  302. new ime[24];
  303. GetPlayerName(playerid, ime, sizeof(ime));
  304. if(VehButtonSet[playerid][0] == 1) // desno
  305. {ShopVeh1[1]++;
  306. if(ShopVeh1[1] > 28) {ShopVeh1[1] = 0;}pa = 1;}
  307. else if(VehButtonSet[playerid][1] == 1) //lijevo
  308. {ShopVeh1[1]--;
  309. if (ShopVeh1[1] < 0) {ShopVeh1[1] = 28;}pa = 1;}
  310. else if(VehButtonSet[playerid][3] == 1) //enter
  311. {
  312. if(AllMyCars(playerid) < MAX_BUYED_VEHS)
  313. {
  314. if(GetPlayerMoney(playerid) >= vCars[ShopVeh1[1]][1])
  315. {
  316.  
  317. MakeXDCarFnc(playerid,0,vCars[ShopVeh1[1]][0],1314.9003,-1859.0258,13.3255,270.3405,ShopVeh1[2],ShopVeh1[3],ime);
  318. TogglePlayerControllable(playerid, 1);
  319. IsShoping[playerid] = 0;
  320. HVozilaTextDraw(playerid);
  321. SetCameraBehindPlayer(playerid);
  322. }else{format(string,sizeof(string),"Nemate dovolno pari!Ovoj avtomobil cini %d$",vCars[ShopVeh1[1]][1]);
  323. SCM(playerid,COLOR_LIGHTRED,string);}
  324. }else{SCM(playerid,COLOR_LIGHTRED,"Ceke gi imate site avtomobili!");}
  325. }
  326. else if (VehButtonSet[playerid][2] == 1)
  327. {TogglePlayerControllable(playerid, 1);
  328. SCM(playerid, COLOR_LIGHTBLUE, "Go prekinavte kupuvanjeto na avtomobili!");
  329. IsShoping[playerid] = 0;
  330. HVozilaTextDraw(playerid);
  331. SetCameraBehindPlayer(playerid);
  332. }
  333. if(pa > 0){
  334. DestroyVehicle(ShopVeh1[0]);
  335. ShopVeh1[0] = CreateVehicle(vCars[ShopVeh1[1]][0], 1292.0682,-1870.6963,13.3741,358.0040, ShopVeh1[2],ShopVeh1[3], 30000);
  336. format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[GetVehicleModel(ShopVeh1[0]) - 400],vCars[ShopVeh1[1]][1]);
  337. TextDrawSetString(CarShopTextDraw[playerid],string);pa = 0;}
  338. }
  339. else if(IsShoping[playerid] == 2)
  340. {
  341. new string[128],pa = 0;
  342. new ime[24];
  343. GetPlayerName(playerid, ime, sizeof(ime));
  344. if(VehButtonSet[playerid][0] == 1) // desno
  345. {ShopVeh2[1]++;
  346. if(ShopVeh2[1] > 9) {ShopVeh2[1] = 0;}pa = 1;}
  347. else if(VehButtonSet[playerid][1] == 1) //lijevo
  348. {ShopVeh2[1]--;
  349. if (ShopVeh2[1] < 0) {ShopVeh2[1] = 28;}pa = 1;}
  350. else if(VehButtonSet[playerid][3] == 1) //enter
  351. {
  352. if(AllMyBikes(playerid) < MAX_BUYED_VEHS)
  353. {
  354. if(GetPlayerMoney(playerid) >= vBikes[ShopVeh2[1]][1])
  355. {
  356.  
  357. MakeXDCarFnc(playerid,1,vBikes[ShopVeh2[1]][0],1314.9003,-1859.0258,13.3255,270.3405,ShopVeh2[2],ShopVeh2[3],ime);
  358. TogglePlayerControllable(playerid, 1);
  359. IsShoping[playerid] = 0;
  360. HVozilaTextDraw(playerid);
  361. SetCameraBehindPlayer(playerid);
  362. }else{format(string,sizeof(string),"Nemate dovolno pari!Ovoj motor cini %d$",vBikes[ShopVeh1[1]][1]);
  363. SCM(playerid,COLOR_LIGHTRED,string);}
  364. }else{SCM(playerid,COLOR_LIGHTRED,"Vec imas sve motore");}
  365. }
  366. else if (VehButtonSet[playerid][2] == 1)
  367. {TogglePlayerControllable(playerid, 1);
  368. SCM(playerid, COLOR_LIGHTBLUE, "Go prekinavte kupuvanjeto na Motorot!");
  369. IsShoping[playerid] = 0;
  370. HVozilaTextDraw(playerid);
  371. SetCameraBehindPlayer(playerid);
  372. }
  373. if(pa > 0){
  374. DestroyVehicle(ShopVeh2[0]);
  375. ShopVeh2[0] = CreateVehicle(vBikes[ShopVeh2[1]][0], 1298.7928,-1870.8855,13.5469,349.0682, ShopVeh2[2],ShopVeh2[3], 30000);
  376. format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[GetVehicleModel(ShopVeh2[0]) - 400],vBikes[ShopVeh2[1]][1]);
  377. TextDrawSetString(CarShopTextDraw[playerid],string);pa = 0;}
  378. }
  379.  
  380. /*
  381.  
  382. In here put for Boats and AirPlanes!!!!
  383. */
  384.  
  385. }
  386. return 1;
  387. }
  388.  
  389. //==========MY VEH FUNCTIONS := Vozila OWNERSHIP================================
  390. //Player KeySet
  391. stock ConvertVehIDtoDYID(VehID)
  392. {
  393. for(new dy; dy < sizeof(MyVehicle);dy++)
  394. {
  395. if(MyVehicle[dy][MyVehSlot] == 1)
  396. {
  397. if(VehID == MyVehicle[dy][MyVehID]) return dy;
  398. }
  399. }
  400. return -1;
  401. }
  402.  
  403. stock PlayerOwnedVehID(playerid,vehicleid)
  404. {
  405. new ime[MAX_PLAYER_NAME];
  406. GetPlayerName(playerid,ime,sizeof(ime));
  407. for(new i = 0; i < sizeof(MyVehicle); i++)
  408. {
  409. if(MyVehicle[i][MyVehSlot] == 1 && MyVehicle[i][MyVehID] == vehicleid)
  410. {
  411. if (strmatch(MyVehicle[i][MyVehOwner], ime))return i;
  412. }
  413. }
  414. return -1;
  415. }
  416. stock AllMyBikes(playerid)//bike
  417. {
  418. new ime[MAX_PLAYER_NAME];
  419. GetPlayerName(playerid,ime,sizeof(ime));
  420. if(IsPlayerConnected(playerid))
  421. {
  422. new i, x;
  423. while (i < sizeof(MyVehicle))
  424. {
  425. if(MyVehicle[i][MyVehSlot] == 1)
  426. {
  427. if(MyVehicle[i][MyVehBike] != -1)
  428. {
  429. if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
  430. }
  431. }
  432. i++;
  433. }
  434. return x;
  435. }
  436. return -1;
  437. }
  438.  
  439. stock GetMyBikeMID(playerid,ID = 0)//bike
  440. {
  441. new ime[MAX_PLAYER_NAME];
  442. GetPlayerName(playerid,ime,sizeof(ime));
  443. new x = 0;
  444. for (new i; i < sizeof(MyVehicle);i++)
  445. {
  446. if(MyVehicle[i][MyVehSlot] == 1)
  447. {
  448. if(MyVehicle[i][MyVehBike] != -1)
  449. {
  450. if (strmatch(MyVehicle[i][MyVehOwner], ime))
  451. { x++;
  452. if(x >= ID )
  453. {return i;}
  454. // return i;
  455. }
  456. }
  457. }
  458. }
  459. return -1;
  460. }
  461.  
  462. stock AllMyCars(playerid)//car
  463. {
  464. new ime[MAX_PLAYER_NAME];
  465. GetPlayerName(playerid,ime,sizeof(ime));
  466. if(IsPlayerConnected(playerid))
  467. {
  468. new i, x;
  469. while (i < sizeof(MyVehicle))
  470. {
  471. if(MyVehicle[i][MyVehSlot] == 1)
  472. {
  473. if(MyVehicle[i][MyVehCar] != -1)
  474. {
  475. if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
  476. }
  477. }
  478. i++;
  479. }
  480. return x;
  481. }
  482. return -1;
  483. }
  484.  
  485. stock GetMyCarMID(playerid,ID = 0)//car
  486. {
  487. new ime[MAX_PLAYER_NAME];
  488. GetPlayerName(playerid,ime,sizeof(ime));
  489. new x = 0;
  490. for (new i; i < sizeof(MyVehicle);i++)
  491. {
  492. if(MyVehicle[i][MyVehSlot] == 1)
  493. {
  494. if(MyVehicle[i][MyVehCar] != -1)
  495. {
  496. if (strmatch(MyVehicle[i][MyVehOwner], ime))
  497. { x++;
  498. if(x >= ID )
  499. {return i;}
  500. // return i;
  501. }
  502. }
  503. }
  504. }
  505. return -1;
  506. }
  507. stock AllMyBoats(playerid)//boat
  508. {
  509. new ime[MAX_PLAYER_NAME];
  510. GetPlayerName(playerid,ime,sizeof(ime));
  511. if(IsPlayerConnected(playerid))
  512. {
  513. new i, x;
  514. while (i < sizeof(MyVehicle))
  515. {
  516. if(MyVehicle[i][MyVehSlot] == 1)
  517. {
  518. if(MyVehicle[i][MyVehBoat] != -1)
  519. {
  520. if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
  521. }
  522. }
  523. i++;
  524. }
  525. return x;
  526. }
  527. return -1;
  528. }
  529.  
  530. stock GetMyBoatMID(playerid,ID = 0)//boat
  531. {
  532. new ime[MAX_PLAYER_NAME];
  533. GetPlayerName(playerid,ime,sizeof(ime));
  534. new x = 0;
  535. for (new i; i < sizeof(MyVehicle);i++)
  536. {
  537. if(MyVehicle[i][MyVehSlot] == 1)
  538. {
  539. if(MyVehicle[i][MyVehBoat] != -1)
  540. {
  541. if (strmatch(MyVehicle[i][MyVehOwner], ime))
  542. { x++;
  543. if(x >= ID )
  544. {return i;}
  545. // return i;
  546. }
  547. }
  548. }
  549. }
  550. return -1;
  551. }
  552. stock AllMyAirs(playerid)//air
  553. {
  554. new ime[MAX_PLAYER_NAME];
  555. GetPlayerName(playerid,ime,sizeof(ime));
  556. if(IsPlayerConnected(playerid))
  557. {
  558. new i, x;
  559. while (i < sizeof(MyVehicle))
  560. {
  561. if(MyVehicle[i][MyVehSlot] == 1)
  562. {
  563. if(MyVehicle[i][MyVehPlane] != -1)
  564. {
  565. if (strmatch(MyVehicle[i][MyVehOwner], ime)) x++;
  566. }
  567. }
  568. i++;
  569. }
  570. return x;
  571. }
  572. return -1;
  573. }
  574.  
  575. stock GetMyAirMID(playerid,ID = 0)//air
  576. {
  577. new ime[MAX_PLAYER_NAME];
  578. GetPlayerName(playerid,ime,sizeof(ime));
  579. new x = 0;
  580. for (new i; i < sizeof(MyVehicle);i++)
  581. {
  582. if(MyVehicle[i][MyVehSlot] == 1)
  583. {
  584. if(MyVehicle[i][MyVehPlane] != -1)
  585. {
  586. if (strmatch(MyVehicle[i][MyVehOwner], ime))
  587. { x++;
  588. if(x >= ID )
  589. {return i;}
  590. // return i;
  591. }
  592. }
  593. }
  594. }
  595. return -1;
  596. }
  597. stock MyCarID(playerid)
  598. {
  599. if(IsPlayerInAnyVehicle(playerid))
  600. {
  601. for(new i = 0; i < sizeof(MyVehicle); i++)
  602. {
  603. if(GetPlayerVehicleID(playerid) == MyVehicle[i][MyVehID])return i;
  604. }
  605. }
  606. return -1;
  607. }
  608. //fnc
  609. stock strmatch(const String1[], const String2[])
  610. {
  611. if ((strcmp(String1, String2, true, strlen(String2)) == 0) && (strlen(String2) == strlen(String1)))
  612. {return true;}
  613. else
  614. {return false;}
  615. }
  616. stock Float:GetDisBetweenPlayerAndCar(p1ayerid,carid)
  617. {
  618. new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  619. if(!IsPlayerConnected(p1ayerid))
  620. {
  621. return -1.00;
  622. }
  623. GetPlayerPos(p1ayerid,x1,y1,z1);
  624. GetVehiclePos(carid,x2,y2,z2);
  625. return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  626. }
  627.  
  628.  
  629. stock GetClosestVehicleToPlayer(playerid)
  630. {
  631. new x,Float:dis,Float:dis2,car;
  632. car = 0;
  633. dis = 99999.99;
  634. for ( x = 0; x < MAX_VEHICLES; x++ )
  635. {
  636. dis2 = GetDisBetweenPlayerAndCar(playerid,x);
  637. if(dis2 < dis && dis2 < 10.0)
  638. {
  639. dis = dis2;
  640. car = x;
  641. }
  642. }
  643. return car;
  644. }
  645. stock VehPriceFromModel(Model)
  646. {
  647. for(new i = 0; i < 29; i++)
  648. {
  649. if(vCars[i][0] == Model) return i;
  650. }
  651. return 0;
  652. }
  653. //Veh Functions
  654. stock MakeXDCarFnc(playerid,X_THREAD,Model,Float:x,Float:y,Float:z,Float:a,col1,col2,name[])//THREAD-0=car=bike,2=boat,3=air
  655. {
  656. for(new i = 0; i < sizeof(MyVehicle); i++ )
  657. {
  658. if(MyVehicle[i][MyVehSlot] == 0)
  659. {
  660. MyVehicle[i][MyVehModel] = Model;
  661. MyVehicle[i][MyVehPos][0]= x;
  662. MyVehicle[i][MyVehPos][1] = y;
  663. MyVehicle[i][MyVehPos][2] = z;
  664. MyVehicle[i][MyVehPos][3] = a;
  665. MyVehicle[i][MyVehCol][0] = col1;
  666. MyVehicle[i][MyVehCol][1] = col2;
  667. MyVehicle[i][MyVehAlarm] = 0;
  668. MyVehicle[i][MyVehLock] = 0;
  669. MyVehicle[i][MyVehCar] = -1;
  670. MyVehicle[i][MyVehPlane] = -1;
  671. MyVehicle[i][MyVehBoat] = -1;
  672. MyVehicle[i][MyVehBike] = -1;
  673. strmid(MyVehicle[i][MyVehOwner], name, 0, strlen(name), 32);
  674.  
  675. MyVehicle[i][MyVehID] = CreateVehicle(
  676. MyVehicle[i][MyVehModel],
  677. MyVehicle[i][MyVehPos][0],
  678. MyVehicle[i][MyVehPos][1],
  679. MyVehicle[i][MyVehPos][2],
  680. MyVehicle[i][MyVehPos][3],
  681. MyVehicle[i][MyVehCol][0],
  682. MyVehicle[i][MyVehCol][1],
  683. 30000);
  684. switch(X_THREAD)
  685. {
  686. case 0:// osobni auto
  687. {
  688. GivePlayerMoney(playerid, -vCars[ShopVeh1[1]][1]);
  689. MyVehicle[i][MyVehCar] = 1;
  690. MyVehicle[i][MyVehSlot] = 1;
  691. SCM(playerid, COLOR_GREEN, "Kupivte Avtomobil!!");
  692. }
  693. case 1://bike
  694. {
  695. GivePlayerMoney(playerid, -vBikes[ShopVeh2[1]][1]);
  696. MyVehicle[i][MyVehBike] = 1;
  697. MyVehicle[i][MyVehSlot] = 1;
  698. SCM(playerid, COLOR_GREEN, "Kupivte Motor!!");
  699. }
  700. case 2:// boat
  701. {
  702. //take money
  703. MyVehicle[i][MyVehBoat] = 1;
  704. MyVehicle[i][MyVehSlot] = 1;
  705. SCM(playerid, COLOR_GREEN, "Kupivte Brod!!");
  706. }
  707. case 3:// air
  708. {
  709. //take money
  710. MyVehicle[i][MyVehPlane] = 1;
  711. MyVehicle[i][MyVehSlot] = 1;
  712. SCM(playerid, COLOR_GREEN, "Kupivte Avion!!");
  713. }
  714. }
  715. UpdateMyVehSystem(i);
  716. printf("MYVC %d,THR %d",i,X_THREAD);
  717. return i;
  718. }
  719. }
  720. return 1;
  721. }
  722. stock ParkMyVehFnc(playerid)
  723. {
  724. // new str[64];
  725. new vozilo = GetPlayerVehicleID(playerid);
  726. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  727. {
  728. if(PlayerOwnedVehID(playerid,vozilo) != -1)
  729. {
  730. new Float:x,Float:y,Float:z;
  731. new Float:a;
  732. GetVehiclePos(vozilo, x, y, z);
  733. GetVehicleZAngle(vozilo, a);
  734. MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][0] = x;
  735. MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][1] = y;
  736. MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][2] = z;
  737. MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][3] = a;
  738. SetVehiclePos(vozilo, MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][0], MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][1],MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][2]);
  739. SetVehicleZAngle(vozilo, MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPos][3]);
  740. if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehCar] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Avtomobil!");
  741. if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehBike] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Motor!");
  742. if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehBoat] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Brod!");
  743. if(MyVehicle[PlayerOwnedVehID(playerid,vozilo)][MyVehPlane] != -1)SCM(playerid, COLOR_GREEN, "Parkiravte Avion!");
  744. UpdateMyVehSystem(PlayerOwnedVehID(playerid,vozilo));
  745. return 1;
  746. }else{SCM(playerid, COLOR_LIGHTRED,"Neste vo vaseto vozilo!");}
  747. }else{SCM(playerid, COLOR_LIGHTRED,"Mora da bidete vo vaseto vozilo!");}
  748. return 0;
  749. }
  750. stock SellMyVehFnc(playerid)
  751. {
  752. //if(IsPlayerInRangeOfPoint(playerid,15.0,1314.5691,-1859.4077,13.7969)){
  753. new ime[MAX_PLAYER_NAME], TCID;
  754. new vozilo = GetPlayerVehicleID(playerid);
  755. GetPlayerName(playerid, ime, sizeof(ime));
  756. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  757. {
  758. if(PlayerOwnedVehID(playerid,vozilo) != -1)
  759. {
  760. TCID =PlayerOwnedVehID(playerid,vozilo);
  761. MyVehicle[TCID][MyVehSlot] = 0;
  762. MyVehicle[TCID][MyVehCar] = -1;
  763. MyVehicle[TCID][MyVehBoat] = -1;
  764. MyVehicle[TCID][MyVehBike] = -1;
  765. MyVehicle[TCID][MyVehPlane] = -1;
  766. strmid(MyVehicle[TCID][MyVehOwner], "Nitko", 0, strlen("Nitko"), 128);
  767. DestroyVehicle(vozilo);
  768. SCM(playerid, COLOR_GREEN, "Go Prodadovte vaseto vozilo");
  769. UpdateMyVehSystem(TCID);
  770. return 1;
  771. }else{SCM(playerid, COLOR_LIGHTRED,"Neste vo svoeto Vozilo!");}
  772. }else{SCM(playerid, COLOR_LIGHTRED,"Mora da bidete vo vaseto Vozilo!");}
  773. // }else{SCM(playerid, COLOR_LIGHTRED, "You are not at delivery place!");}
  774. return 1;
  775. }
  776.  
  777.  
  778. stock LocateMyVehFnc(playerid,THREAD_V)//0=my_car,1_my_bike,2_my_boat,3_my_air
  779. {
  780. switch(THREAD_V)
  781. {
  782. case 0:// mycar
  783. {
  784. new cm = AllMyCars(playerid);
  785. if(cm > 0)
  786. {
  787. clx[playerid] ++;
  788. if(clx[playerid] > cm) {clx[playerid] = 0;}
  789. new Float:VPos[3];
  790. GetVehiclePos(MyVehicle[GetMyCarMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
  791. SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
  792. if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
  793. }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
  794. }
  795. case 1:// mybike
  796. {
  797. new cm = AllMyBikes(playerid);
  798. if(cm > 0)
  799. {
  800. clx[playerid] ++;
  801. if(clx[playerid] > cm) {clx[playerid] = 0;}
  802. new Float:VPos[3];
  803. GetVehiclePos(MyVehicle[GetMyBikeMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
  804. SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
  805. if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
  806. }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
  807. }
  808. case 2:// myboat
  809. {
  810. new cm = AllMyBoats(playerid);
  811. if(cm > 0)
  812. {
  813. clx[playerid] ++;
  814. if(clx[playerid] > cm) {clx[playerid] = 0;}
  815. new Float:VPos[3];
  816. GetVehiclePos(MyVehicle[GetMyBoatMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
  817. SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
  818. if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
  819. }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
  820. }
  821. case 3:// myair
  822. {
  823. new cm = AllMyAirs(playerid);
  824. if(cm > 0)
  825. {
  826. clx[playerid] ++;
  827. if(clx[playerid] > cm) {clx[playerid] = 0;}
  828. new Float:VPos[3];
  829. GetVehiclePos(MyVehicle[GetMyAirMID(playerid,clx[playerid])][MyVehID], VPos[0],VPos[1],VPos[2]);
  830. SetPlayerCheckpoint(playerid,VPos[0],VPos[1],VPos[2],8.0);
  831. if(clx[playerid] == 0){DisablePlayerCheckpoint(playerid);}
  832. }else{SCM(playerid, COLOR_LIGHTRED, "Nemate Vozilo od ovaa vrsta!");}
  833. }
  834. }
  835. return 0;
  836. }
  837.  
  838. stock LockMyVehFnc(playerid)
  839. {
  840. new TCID,Float:CPs[3];
  841. TCID = GetClosestVehicleToPlayer(playerid);
  842. GetVehiclePos(TCID,CPs[0],CPs[1],CPs[2]);
  843. if(IsPlayerInRangeOfPoint(playerid,3.0,CPs[0],CPs[1],CPs[2]))
  844. {
  845. if(PlayerOwnedVehID(playerid,TCID) != -1)
  846. {
  847. if(MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] == 0)
  848. {
  849. MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] = 1;
  850. SCM(playerid, COLOR_LIGHTRED, "Voziloto e zakluceno!");
  851. }
  852. else if(MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] == 1)
  853. {
  854. MyVehicle[PlayerOwnedVehID(playerid,TCID)][MyVehLock] = 0;
  855. SCM(playerid, COLOR_LIGHTGREEN, "Voziloto e otkluceno!");
  856. }
  857. UpdateMyVehSystem(PlayerOwnedVehID(playerid,TCID));
  858. }else{SCM(playerid, COLOR_LIGHTRED, "Ovaa ne e tvoe vozilo!");}
  859. }else{SCM(playerid, COLOR_LIGHTRED, "Ne ste do vaseto vozilo!");}
  860. return 0;
  861. }
  862. //Admin cmds
  863. stock AparkMyVeh(playerid, MyCarID)
  864. {
  865. if(IsPlayerAdmin(playerid))
  866. {
  867. new vozilo = GetPlayerVehicleID(playerid);
  868. new Float:x,Float:y,Float:z;
  869. new Float:a;
  870. GetVehiclePos(vozilo, x, y, z);
  871. GetVehicleZAngle(vozilo, a);
  872. MyVehicle[MyCarID][MyVehPos][0] = x;
  873. MyVehicle[MyCarID][MyVehPos][1] = y;
  874. MyVehicle[MyCarID][MyVehPos][2] = z;
  875. MyVehicle[MyCarID][MyVehPos][3] = a;
  876. SetVehiclePos(vozilo, MyVehicle[MyCarID][MyVehPos][0], MyVehicle[MyCarID][MyVehPos][1],MyVehicle[MyCarID][MyVehPos][2]);
  877. SetVehicleZAngle(vozilo, MyVehicle[MyCarID][MyVehPos][3]);
  878. SCM(playerid, COLOR_GREEN, "[ADMIN]Vozilo parkirano!");
  879. UpdateMyVehSystem(MyCarID);
  880. }else{SCM(playerid, COLOR_LIGHTRED, "Neste ovlasteni da ja goristite ovaa komanda!");}
  881. return 1;
  882. }
  883.  
  884. stock AsellMyVeh(playerid, MyCarID)
  885. {
  886. if(IsPlayerAdmin(playerid))
  887. {
  888. MyVehicle[MyCarID][MyVehSlot] = 0;
  889. MyVehicle[MyCarID][MyVehModel] = 0;
  890. MyVehicle[MyCarID][MyVehCar] = -1;
  891. MyVehicle[MyCarID][MyVehBike] = -1;
  892. MyVehicle[MyCarID][MyVehBoat] = -1;
  893. MyVehicle[MyCarID][MyVehPlane] = 1;
  894. strmid(MyVehicle[MyCarID][MyVehOwner], "Nitko", 0, strlen("Nitko"), 64);
  895. DestroyVehicle(MyVehicle[MyCarID][MyVehID]);
  896. SCM(playerid, COLOR_LIGHTGREEN, "[ADMIN] Vozilo prodadeno!");
  897. UpdateMyVehSystem(MyCarID);
  898. }else{SCM(playerid, COLOR_LIGHTRED, "Neste ovlasteni da ja goristite ovaa komanda!");}
  899. return 1;
  900. }
  901.  
  902.  
  903. //Saving/loading system
  904. stock LoadMyVehSystem()
  905. {
  906. new reload[256];
  907. new loader[64];
  908. if(!dini_Exists(SaveFile))
  909. {
  910. dini_Create(SaveFile);
  911. }
  912. for(new i = 0;i<sizeof(MyVehicle);i++)
  913. {
  914. format(loader,sizeof(loader),"MyCar_%d",i);
  915. strmid(reload,dini_Get(SaveFile,loader),0,256,256);
  916. new data2[32]; //STRING
  917. sscanf(reload,
  918. "p<,>dd\
  919. ffff\
  920. ddd\
  921. s[64]\
  922. d\
  923. dddd\
  924. d",
  925. MyVehicle[i][MyVehSlot],MyVehicle[i][MyVehModel],
  926. MyVehicle[i][MyVehPos][0],MyVehicle[i][MyVehPos][1],MyVehicle[i][MyVehPos][2],MyVehicle[i][MyVehPos][3],
  927. MyVehicle[i][MyVehCol][0],MyVehicle[i][MyVehCol][1],MyVehicle[i][MyVehLock],
  928. data2, // string
  929. MyVehicle[i][MyVehAlarm],
  930. MyVehicle[i][MyVehCar],MyVehicle[i][MyVehBike],MyVehicle[i][MyVehBoat],MyVehicle[i][MyVehPlane],
  931. MyVehicle[i][MyVehFsale]);
  932. strmid(MyVehicle[i][MyVehOwner], data2, 0, strlen(data2), 64);// kraj loadanja
  933.  
  934. if(MyVehicle[i][MyVehSlot] == 1 && (MyVehicle[i][MyVehCar] != -1 || MyVehicle[i][MyVehBike] != -1 || MyVehicle[i][MyVehBoat] != -1 || MyVehicle[i][MyVehPlane] != -1))
  935. {
  936. MyVehicle[i][MyVehID] = CreateVehicle(MyVehicle[i][MyVehModel],MyVehicle[i][MyVehPos][0],MyVehicle[i][MyVehPos][1],MyVehicle[i][MyVehPos][2],MyVehicle[i][MyVehPos][3],MyVehicle[i][MyVehCol][0],MyVehicle[i][MyVehCol][1],30000);
  937. }
  938. }
  939. return 1;
  940. }
  941.  
  942. stock UpdateMyVehSystem(id)
  943. {
  944. new GSi[256];
  945. new place[64];
  946. if(!dini_Exists(SaveFile))
  947. {
  948. dini_Create(SaveFile);
  949. }
  950. format(GSi,sizeof(GSi),
  951. "%d,%d,\
  952. %f,%f,%f,%f,\
  953. %d,%d,%d,\
  954. %s,\
  955. %d,\
  956. %d,%d,%d,%d,\
  957. %d",
  958. MyVehicle[id][MyVehSlot],MyVehicle[id][MyVehModel],
  959. MyVehicle[id][MyVehPos][0],MyVehicle[id][MyVehPos][1],MyVehicle[id][MyVehPos][2],MyVehicle[id][MyVehPos][3],
  960. MyVehicle[id][MyVehCol][0],MyVehicle[id][MyVehCol][1],MyVehicle[id][MyVehLock],
  961. MyVehicle[id][MyVehOwner], // string
  962. MyVehicle[id][MyVehAlarm],
  963. MyVehicle[id][MyVehCar],MyVehicle[id][MyVehBike],MyVehicle[id][MyVehBoat],MyVehicle[id][MyVehPlane],
  964. MyVehicle[id][MyVehFsale]);
  965. format(place,sizeof(place),"MyCar_%d",id);
  966. dini_Set(SaveFile,place,GSi);
  967. printf("ID %d SET",id);
  968. if(MyVehicle[id][MyVehSlot] == 0)
  969. {
  970. format(GSi,sizeof(GSi),
  971. "%d,%d,\
  972. %f,%f,%f,%f,\
  973. %d,%d,%d,\
  974. %s,\
  975. %d,\
  976. %d,%d,%d,%d,\
  977. %d",
  978. MyVehicle[id][MyVehSlot],MyVehicle[id][MyVehModel],
  979. MyVehicle[id][MyVehPos][0],MyVehicle[id][MyVehPos][1],MyVehicle[id][MyVehPos][2],MyVehicle[id][MyVehPos][3],
  980. MyVehicle[id][MyVehCol][0],MyVehicle[id][MyVehCol][1],MyVehicle[id][MyVehLock],
  981. MyVehicle[id][MyVehOwner], // string
  982. MyVehicle[id][MyVehAlarm],
  983. MyVehicle[id][MyVehCar],MyVehicle[id][MyVehBike],MyVehicle[id][MyVehBoat],MyVehicle[id][MyVehPlane],
  984. MyVehicle[id][MyVehFsale]);
  985. format(place,sizeof(place),"MyCar_%d",id);
  986. dini_Unset(SaveFile ,place);
  987. printf("ID %d UNSET",id);
  988. }
  989. return 1;
  990. }
  991.  
  992. //======================= COMMANDS =============================================
  993. CMD:carshop(playerid,params[])
  994. {
  995. if(IsShoping[playerid] == 0)
  996. {
  997. if(GetPlayerState(playerid) != 2)
  998. {
  999. if(IsPlayerInRangeOfPoint(playerid,7.00,1292.0682,-1870.6963,13.3741))
  1000. {
  1001. new string[128];
  1002. TogglePlayerControllable(playerid, 0);
  1003. IsShoping[playerid] = 1;
  1004. SCM(playerid, COLOR_LIGHTBLUE, " Koristite Strela Levo(<)Desno(>)za da odberete avtomobil!");
  1005. SCM(playerid, COLOR_LIGHTBLUE, " Za da go kupite avtomobilot pritisnite (F)");
  1006. SCM(playerid, COLOR_LIGHTBLUE, " Za prekinuvanje na kupuvanjeto pretisnete CTRL");
  1007. SVozilaTextDraw(playerid);
  1008. format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[vCars[ShopVeh1[1]][0] -400],vCars[ShopVeh1[1]][1]);
  1009. TextDrawSetString(CarShopTextDraw[playerid],string);
  1010. }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
  1011. }else{SCM(playerid, COLOR_LIGHTRED, " Nemozete da kupuvate od voziloto!");}
  1012. }else{SCM(playerid, COLOR_LIGHTRED, " Veke go listate nalogot!");}
  1013. return 1;
  1014. }
  1015.  
  1016. CMD:carshopcol(playerid,params[])
  1017. {
  1018. if(IsPlayerInRangeOfPoint(playerid,7.00,1292.0682,-1870.6963,13.3741))
  1019. {
  1020. new boja1,boja2;
  1021. if (sscanf(params, "dd",boja1,boja2)) SCM(playerid, COLOR_WHITE, "Koristenje: /carshopcol [boja 1] [boja 2]");
  1022. else if(boja1 < 0 || boja1 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
  1023. else if(boja2 < 0 || boja2 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
  1024. else
  1025. {
  1026. ShopVeh1[2] = boja1;
  1027. ShopVeh1[3] = boja2;
  1028. ChangeVehicleColor(ShopVeh1[0],boja1,boja2);
  1029. SCM(playerid, COLOR_LIGHTBLUE, "*Ja promenivte bojata na katalogod!");
  1030. }
  1031. }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
  1032. return 1;
  1033. }
  1034. CMD:bikeshop(playerid,params[])
  1035. {
  1036. if(IsShoping[playerid] == 0)
  1037. {
  1038. if(GetPlayerState(playerid) != 2)
  1039. {
  1040. if(IsPlayerInRangeOfPoint(playerid,7.00,1298.7928,-1870.8855,13.5469))
  1041. {
  1042. new string[128];
  1043. TogglePlayerControllable(playerid, 0);
  1044. IsShoping[playerid] = 2;
  1045. SCM(playerid, COLOR_LIGHTBLUE, " Koristite Strela Levo(<)Desno(>)za da odberete avtomobil!");
  1046. SCM(playerid, COLOR_LIGHTBLUE, " Za da go kupite avtomobilot pritisnite (F)");
  1047. SCM(playerid, COLOR_LIGHTBLUE, " Za prekinuvanje na kupuvanjeto pretisnete CTRL");
  1048. SVozilaTextDraw(playerid);
  1049. format(string,sizeof(string),"~w~%s~n~~n~~h~~h~~b~Cena: %d~n~~n~~h~~h~~y~< ~g~ponatamu ~h~~h~~y~>",VehNames[vBikes[ShopVeh2[1]][0] -400],vBikes[ShopVeh2[1]][1]);
  1050. TextDrawSetString(CarShopTextDraw[playerid],string);
  1051. }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
  1052. }else{SCM(playerid, COLOR_LIGHTRED, " Nemozete da kupuvate od voziloto!");}
  1053. }else{SCM(playerid, COLOR_LIGHTRED, " Veke go listate nalogot!");}
  1054. return 1;
  1055. }
  1056. CMD:bikeshopcol(playerid,params[])
  1057. {
  1058. if(IsPlayerInRangeOfPoint(playerid,7.00,1298.7928,-1870.8855,13.5469))
  1059. {
  1060. new boja1,boja2;
  1061. if (sscanf(params, "dd",boja1,boja2)) SCM(playerid, COLOR_WHITE, "Koristenje: /bikeshopcol [boja 1] [boja 2]");
  1062. else if(boja1 < 0 || boja1 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
  1063. else if(boja2 < 0 || boja2 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!!");
  1064. else
  1065. {
  1066. ShopVeh2[2] = boja1;
  1067. ShopVeh2[3] = boja2;
  1068. ChangeVehicleColor(ShopVeh2[0],boja1,boja2);
  1069. SCM(playerid, COLOR_LIGHTBLUE, "*Ja promenivte bojata na katalogot!");
  1070. }
  1071. }else{SCM(playerid, COLOR_LIGHTRED, " Neste vo salonot!");}
  1072. return 1;
  1073. }
  1074.  
  1075. CMD:buyveh(playerid,params[])
  1076. {
  1077. if(EnCV[playerid] != -1)
  1078. {
  1079. if(MyVehicle[EnCV[playerid]][MyVehFsale] > 0)
  1080. {
  1081. if(MyVehicle[EnCV[playerid]][MyVehFsale] <= GetPlayerMoney(playerid))
  1082. {
  1083. new Float:CPs[3];
  1084.  
  1085. GetVehiclePos(MyVehicle[EnCV[playerid]][MyVehID],CPs[0],CPs[1],CPs[2]);
  1086. if(IsPlayerInRangeOfPoint(playerid,4.2,CPs[0],CPs[1],CPs[2]))
  1087. {
  1088. if(MyVehicle[EnCV[playerid]][MyVehCar] == 1 && AllMyCars(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
  1089. if(MyVehicle[EnCV[playerid]][MyVehBike] == 1 && AllMyBikes(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
  1090. if(MyVehicle[EnCV[playerid]][MyVehBoat] == 1 && AllMyBoats(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
  1091. if(MyVehicle[EnCV[playerid]][MyVehPlane] == 1 && AllMyAirs(playerid) >= MAX_BUYED_VEHS) return SCM(playerid, COLOR_LIGHTRED, "Nemozes kupiti vise vozila ove vrste!");
  1092. new ime[MAX_PLAYER_NAME];
  1093. GetPlayerName(playerid,ime,sizeof(ime));
  1094. GivePlayerMoney(playerid, -MyVehicle[EnCV[playerid]][MyVehFsale]);
  1095. strmid(MyVehicle[EnCV[playerid]][MyVehOwner], ime, 0, strlen(ime), 64);
  1096. MyVehicle[EnCV[playerid]][MyVehFsale] = 0;
  1097. UpdateMyVehSystem(EnCV[playerid]);
  1098. EnCV[playerid] = -1;
  1099. SCM(playerid, COLOR_GREEN, "You bought vehicle!");
  1100. }else{SCM(playerid, COLOR_LIGHTRED, "Neste do voziloto koe sakate da go kupite!");}
  1101. }else{SCM(playerid, COLOR_LIGHTRED, "Nemate dovolno pari!");}
  1102. }else{SCM(playerid, COLOR_LIGHTRED, "Ovaa vozilo ne e na prodazba!");}
  1103. }else{SCM(playerid, COLOR_LIGHTRED, "Neste poglednale nitu eden avtomobil za kupuvanje!");}
  1104. return 1;
  1105. }
  1106. CMD:sellveh(playerid, params[])
  1107. {
  1108. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  1109. {
  1110. new vozilo = GetPlayerVehicleID(playerid);
  1111. if(PlayerOwnedVehID(playerid,vozilo) != -1)
  1112. {
  1113. new Novac;
  1114. new Float:x,Float:y,Float:z;
  1115. new Float:a;
  1116. if (sscanf(params, "d",Novac)) SCM(playerid, COLOR_WHITE, "Koristenje: /sellveh [cijena]");
  1117. else
  1118. {
  1119. GetVehiclePos(vozilo, x, y, z);
  1120. GetVehicleZAngle(vozilo, a);
  1121. strmid(MyVehicle[MyCarID(playerid)][MyVehOwner], "Nitko", 0, strlen("Nitko"), 24);
  1122. MyVehicle[MyCarID(playerid)][MyVehFsale] = Novac;
  1123. GivePlayerMoney(playerid, Novac);
  1124. MyVehicle[MyCarID(playerid)][MyVehPos][0] = x;
  1125. MyVehicle[MyCarID(playerid)][MyVehPos][1] = y;
  1126. MyVehicle[MyCarID(playerid)][MyVehPos][2] = z;
  1127. MyVehicle[MyCarID(playerid)][MyVehPos][3] = a;
  1128. SetVehiclePos(vozilo, MyVehicle[MyCarID(playerid)][MyVehPos][0], MyVehicle[MyCarID(playerid)][MyVehPos][1],MyVehicle[MyCarID(playerid)][MyVehPos][2]);
  1129. SetVehicleZAngle(vozilo, MyVehicle[MyCarID(playerid)][MyVehPos][3]);
  1130. RemovePlayerFromVehicle(playerid);
  1131. UpdateMyVehSystem(MyCarID(playerid));
  1132. SCM(playerid, COLOR_GREEN, "Go Prodadovte svoeto vozilo!");
  1133. }
  1134. }else{SCM(playerid, COLOR_LIGHTRED, "Nemate dukumenti od ovaa vozilo!");}
  1135. }else{SCM(playerid, COLOR_LIGHTRED, "Mora da bidete vo voziloto!");}
  1136. return 1;
  1137. }
  1138.  
  1139.  
  1140.  
  1141. CMD:mycar(playerid,params[])
  1142. {
  1143. new opcija[24],ime[32];
  1144. if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /mycar [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
  1145. else
  1146. {
  1147. GetPlayerName(playerid, ime,sizeof(ime));
  1148. if(strmatch("park",opcija))
  1149. {
  1150. ParkMyVehFnc(playerid);
  1151. return 1;
  1152. }
  1153. if(strmatch("lock",opcija))
  1154. {
  1155. LockMyVehFnc(playerid);
  1156. return 1;
  1157. }
  1158. if(strmatch("sell",opcija))
  1159. {
  1160. SellMyVehFnc(playerid);
  1161. return 1;
  1162. }
  1163. if(strmatch("locate",opcija))
  1164. {
  1165. LocateMyVehFnc(playerid,0);
  1166. return 1;
  1167. }
  1168. }
  1169. return 1;
  1170. }
  1171.  
  1172. CMD:mybike(playerid,params[])
  1173. {
  1174. new opcija[24],ime[32];
  1175. if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /mybike [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
  1176. else
  1177. {
  1178. GetPlayerName(playerid, ime,sizeof(ime));
  1179. if(strmatch("park",opcija))
  1180. {
  1181. ParkMyVehFnc(playerid);
  1182. return 1;
  1183. }
  1184. if(strmatch("lock",opcija))
  1185. {
  1186. LockMyVehFnc(playerid);
  1187. return 1;
  1188. }
  1189. if(strmatch("sell",opcija))
  1190. {
  1191. SellMyVehFnc(playerid);
  1192. return 1;
  1193. }
  1194. if(strmatch("locate",opcija))
  1195. {
  1196. LocateMyVehFnc(playerid,1);
  1197. return 1;
  1198. }
  1199. }
  1200. return 1;
  1201. }
  1202. CMD:myboat(playerid,params[])
  1203. {
  1204. new opcija[24],ime[32];
  1205. if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /myboat [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
  1206. else
  1207. {
  1208. GetPlayerName(playerid, ime,sizeof(ime));
  1209. if(strmatch("park",opcija))
  1210. {
  1211. ParkMyVehFnc(playerid);
  1212. return 1;
  1213. }
  1214. if(strmatch("lock",opcija))
  1215. {
  1216. LockMyVehFnc(playerid);
  1217. return 1;
  1218. }
  1219. if(strmatch("sell",opcija))
  1220. {
  1221. SellMyVehFnc(playerid);
  1222. return 1;
  1223. }
  1224. if(strmatch("locate",opcija))
  1225. {
  1226. LocateMyVehFnc(playerid,2);
  1227. return 1;
  1228. }
  1229. }
  1230. return 1;
  1231. }
  1232. CMD:myair(playerid,params[])
  1233. {
  1234. new opcija[24],ime[32];
  1235. if (sscanf(params, "s[24]", opcija)) SCM(playerid, COLOR_WHITE, "Koristenje: /myair [opcii]"),SCM(playerid, COLOR_WHITE, "opcii: park, lock, sell, locate");
  1236. else
  1237. {
  1238. GetPlayerName(playerid, ime,sizeof(ime));
  1239. if(strmatch("park",opcija))
  1240. {
  1241. ParkMyVehFnc(playerid);
  1242. return 1;
  1243. }
  1244. if(strmatch("lock",opcija))
  1245. {
  1246. LockMyVehFnc(playerid);
  1247. return 1;
  1248. }
  1249. if(strmatch("sell",opcija))
  1250. {
  1251. SellMyVehFnc(playerid);
  1252. return 1;
  1253. }
  1254. if(strmatch("locate",opcija))
  1255. {
  1256. LocateMyVehFnc(playerid,3);
  1257. return 1;
  1258. }
  1259. }
  1260. return 1;
  1261. }
  1262.  
  1263. CMD:apark(playerid,params[])
  1264. {
  1265. if(IsPlayerInAnyVehicle(playerid))
  1266. {
  1267. AparkMyVeh(playerid, MyCarID(playerid));
  1268. }
  1269. return 1;
  1270. }
  1271. CMD:asellveh(playerid,params[])
  1272. {
  1273. if(IsPlayerInAnyVehicle(playerid))
  1274. {
  1275. AsellMyVeh(playerid, MyCarID(playerid));
  1276. }
  1277. return 1;
  1278. }
  1279. CMD:makesaleveh(playerid, params[])
  1280. {
  1281. new vrsta,model,boja1,boja2,cijena;
  1282. if (sscanf(params, "ddddd",vrsta,model,boja1,boja2,cijena)) SCM(playerid, COLOR_WHITE, "Koristenje: /makesaleveh [vrsta] [ModelID] [boja1] [boja2] [cijena]");
  1283. else if(vrsta < 0 || vrsta > 3) SCM(playerid, COLOR_LIGHTGREEN, "Vrsta: 0-Avtomobil,1-Motor,2-Brod,3-Avion");
  1284. else if(model < 400 || model > 611) SCM(playerid, COLOR_WHITE, "Model na vozilo nemoze da bide ispod 400 i nad 611!");
  1285. else if(boja1 < 0 || boja1 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!");
  1286. else if(boja2 < 0 || boja2 > 126) SCM(playerid, COLOR_WHITE, "Boja nemoze da bide pod 0 i nad 126!");
  1287. else if(cijena < 1 || cijena > 100000000) SCM(playerid, COLOR_WHITE, "Cena nemoze da bide pod 0!");
  1288. else
  1289. {
  1290. if(IsPlayerAdmin(playerid))
  1291. {
  1292. new Float:X,Float:Y,Float:Z,Float:A, s;
  1293. GetPlayerPos(playerid, X,Y,Z);
  1294. s = MakeXDCarFnc(playerid,vrsta,model,X+1.5,Y+2.5,Z+2.0,A,boja1,boja2,"Nitko");//THREAD-0=car=bike,2=boat,3=air
  1295. MyVehicle[s][MyVehFsale] = cijena;
  1296. SCM(playerid, COLOR_LIGHTRED, "Stavivte vozilo na prodazba!");
  1297. printf("TYP:%d, ID:%d",vrsta,s);
  1298. UpdateMyVehSystem(s);
  1299. }else{SCM(playerid, COLOR_LIGHTRED, "Neste ovlasten za ovaa komanda!");}
  1300. }
  1301. return 1;
  1302. }
  1303.  
  1304. CMD:vehhelp(playerid,params[])
  1305. {
  1306. SCM(playerid, COLOR_LIGHTBLUE, "|_____________________VEHICLE HELP____________________|");
  1307. SCM(playerid, COLOR_LIGHTBLUE, "CMD: /carshop, /carshopcol, /bikeshop, /bikeshopcol");
  1308. SCM(playerid, COLOR_LIGHTBLUE, "CMD: /mycar");
  1309. SCM(playerid, COLOR_LIGHTBLUE, "CMD: /mybike");
  1310. SCM(playerid, COLOR_LIGHTBLUE, "CMD: /myboat (Treba samo napraviti salon)");
  1311. SCM(playerid, COLOR_LIGHTBLUE, "CMD: /myair (Treba samo napraviti salon)");
  1312. SCM(playerid, COLOR_LIGHTBLUE, "CMD: /sellveh, /buyveh (kada pokusate uci i cijena se pokaze))");
  1313. SCM(playerid, COLOR_LIGHTBLUE, "ADMIN: /asellveh, /apark, /makesaleveh");
  1314. return 1;
  1315. }
Advertisement
Add Comment
Please, Sign In to add comment