Advertisement
Guest User

Roleplay Script

a guest
Feb 18th, 2013
7,551
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 184.31 KB | None | 0 0
  1. #include <a_samp>
  2. #include <Dini>
  3.  
  4. #define MAX_HOUSES 500
  5. #define MAX_FACTIONS 50
  6. #define MAX_BUSINESS 50
  7. #define MAX_BANKS 20
  8. #define MAX_VEHICLES_SHOPS 50
  9. #define MAX_JOBS 50
  10. #define MAX_24_7_STORES 50
  11. #define MAX_ATMS 250
  12. #define MAX_SPEEDCAMS 500
  13. #define MAX_GASSTATIONS 50
  14. #define OBJ_HOUSE 1
  15. #define OBJ_FACTION 2
  16. #define OBJ_BUSINESS 3
  17. #define OBJ_STORE 4
  18. #define OBJ_BANK 5
  19. #define ResetMoneyBar ResetPlayerMoney
  20. #define UpdateMoneyBar GivePlayerMoney
  21. #define COLOR_GREY 0xAFAFAFAA
  22. #define COLOR_GREEN 0x33AA33AA
  23. #define COLOR_RED 0xAA3333AA
  24. #define COLOR_BLUE 0xE0EEEE
  25. #define COLOR_YELLOW 0xFFFF00AA
  26. #define COLOR_WHITE 0xFFFFFFAA
  27. #define COLOR_PURPLE 0xCC99CC
  28. #define COLOR_FADE1 0xE6E6E6E6
  29. #define COLOR_FADE2 0xC8C8C8C8
  30. #define COLOR_FADE3 0xAAAAAAAA
  31. #define COLOR_FADE4 0x8C8C8C8C
  32. #define COLOR_FADE5 0x6E6E6E6E
  33. #define SERVERNAME "AoTv Roleplay"
  34.  
  35. native IsValidVehicle(vehicleid);
  36. forward AddVehicle(model, Float:x, Float:y, Float:z, Float:facing_angle, color_1, color_2, faction, faction_rank);
  37. forward LoadVehicles(static_vehicle);
  38. forward RegisterPlayer(playerid, const password[]);
  39. forward LoginPlayer(const PlayerName[], const PlayerPassword[]);
  40. forward AddFaction(const Name[], type);
  41. forward SetFactionRankName(const Faction_Name[], Rank, const Rank_Name[]);
  42. forward SetFactionRankSkin(const Faction_Name[], Rank, SkinID);
  43. forward AddFactionHQ(const Faction_HQ_Name[], Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid);
  44. forward LoadFactions();
  45. forward AddBank(Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid);
  46. forward LoadBanks();
  47. forward CreateHouse(const housename[], const owner[], price, locked, onsale, Float:x, Float:y, Float:z, Float:ix, Float:iy, Float:iz, interior);
  48. forward LoadHouses();
  49. forward AddMapIcon(playerid, icon_type);
  50. forward LoadMapIcons();
  51. forward TutorialStep1(playerid);
  52. forward TutorialStep2(playerid);
  53. forward TutorialStep3(playerid);
  54. forward TutorialStep4(playerid);
  55. forward TutorialStep5(playerid);
  56. forward TutorialFinish(playerid);
  57. forward AddBusiness(playerid, const Business_Name[], const bOwner_Name[], bEnter_Fee, bOnSale, bPrice, bLocked, Float:Interior_X, Float:Interior_Y, Float:Interior_Z, bInterior);
  58. forward LoadBusiness();
  59. forward AddVehicleShop(playerid, const Vehicle_Shop_Name[]);
  60. forward LoadVehicleShops();
  61. forward SetVehicleSpawn(shopid, playerid);
  62. forward LoadVehicleSpawns();
  63. forward ToggleVehicleEngine(vehicleid, toggle);
  64. forward SwitchEngineOn(playerid, vehicleid);
  65. forward Add247(playerid, interior);
  66. forward Load247();
  67. forward CreatePickupEx(pickup_model, pickup_type, Float:pickup_X, Float:pickup_Y, Float:pickup_Z, pickup_virtualworld);
  68. forward GetPickupModel(pickupid);
  69. forward SaveAccount(const Player_Name[], crashed);
  70. forward AddJob(const Job_Name[], Job_Type, Float:Job_X, Float:Job_Y, Float:Job_Z);
  71. forward LoadJobs();
  72. forward ReloadBusinessFile();
  73. forward AntiCheatMoney();
  74. forward AntiCheatWeapon();
  75. forward Speedo(playerid);
  76. forward FuelSystem();
  77. forward Translate(playerid, color, const Message[], const Language[]);
  78. forward BankSystem(const Option[], Amount, playerid, giveid);
  79. forward VehiclePlates();
  80. forward GenerateVehiclePlate();
  81. forward AddAtm(playerid);
  82. forward LoadAtms();
  83. forward AddSpeedCam(playerid, maxspeed);
  84. forward LoadSpeedCams();
  85. forward SpeedCamsTimer();
  86. forward SpeedCamCheck(playerid);
  87. forward AddGasStation(playerid, rate, name[]);
  88. forward LoadGasStations();
  89. forward Fueling(playerid, vehicleid, money);
  90. forward FixVehicle(playerid, vehicleid);
  91. forward AddUsableCommand(rank, type, const command[]);
  92. forward LoadUsableCommands(type);
  93. forward IsUsableCommand(rank, type, const command[]);
  94. forward DragPlayer(playerid, id);
  95. forward TazePlayer(playerid);
  96. forward StealVehicle(playerid, vehicleid);
  97.  
  98. new ShowSpeedo[MAX_PLAYERS];
  99. new SpeedoTimer[MAX_PLAYERS];
  100. new VehicleFuel[MAX_VEHICLES];
  101.  
  102. new WrongPassword[MAX_PLAYERS] = 0;
  103. new bool:OOC_Enabled;
  104.  
  105. enum _gasstations{
  106. gssname[24],
  107. gssrate,
  108. Float:gssx,
  109. Float:gssy,
  110. Float:gssz,
  111. }
  112.  
  113. new GasStations[MAX_GASSTATIONS][_gasstations];
  114.  
  115. enum ucommands{
  116. uctype,
  117. ucrank,
  118. ucc[64]
  119. }
  120.  
  121. new UsableCommands[][ucommands];
  122.  
  123. enum Plates{
  124. Number
  125. }
  126.  
  127. new VehiclePlatesSys[MAX_VEHICLES][Plates];
  128.  
  129. enum _Job_Informations{
  130. jName[24],
  131. jType,
  132. Float:jPos_X,
  133. Float:jPos_Y,
  134. Float:jPos_Z
  135. }
  136.  
  137. new Job_Infos[MAX_JOBS][_Job_Informations];
  138.  
  139. new OfferedVehicle[MAX_PLAYERS];
  140. new OfferVehiclePlayer[MAX_PLAYERS];
  141. new OfferVehiclePrice[MAX_PLAYERS];
  142. new OfferVehicleModel[MAX_PLAYERS];
  143.  
  144. new OfferedHouse[MAX_PLAYERS];
  145. new OfferedHousePlayer[MAX_PLAYERS];
  146. new OfferedHousePrice[MAX_PLAYERS];
  147.  
  148. new OfferedBusiness[MAX_PLAYERS];
  149. new OfferedBusinessPlayer[MAX_PLAYERS];
  150. new OfferedBusinessPrice[MAX_PLAYERS];
  151.  
  152. enum _Pickup{
  153. puModel,
  154. puType,
  155. Float:puX,
  156. Float:puY,
  157. Float:puZ,
  158. puVirtualWorld
  159. }
  160.  
  161. new PickUps[MAX_PICKUPS][_Pickup];
  162.  
  163. enum _247{
  164. Float:sEnter_X,
  165. Float:sEnter_Y,
  166. Float:sEnter_Z,
  167. Float:sInt_X,
  168. Float:sInt_Y,
  169. Float:sInt_Z,
  170. sInt
  171. }
  172.  
  173. new Stores_Infos[MAX_24_7_STORES][_247];
  174.  
  175. enum _atms{
  176. Float:atm_x,
  177. Float:atm_y,
  178. Float:atm_z,
  179. Float:atm_rot,
  180. atm_objid
  181. }
  182.  
  183. new ATM_Infos[MAX_ATMS][_atms];
  184.  
  185. enum _speedcams{
  186. Float:scx,
  187. Float:scy,
  188. Float:scz,
  189. Float:scfa,
  190. scmaxspeed,
  191. scobjid
  192. }
  193.  
  194. new SpeedCams[MAX_SPEEDCAMS][_speedcams];
  195.  
  196. new SpeedCamPlayer[MAX_PLAYERS];
  197.  
  198. enum VehiclesShops{
  199. vsName[24],
  200. Float:vsX,
  201. Float:vsY,
  202. Float:vsZ,
  203. Float:vsvsx,
  204. Float:vsvsy,
  205. Float:vsvsz,
  206. Float:vsvsfa
  207. }
  208.  
  209. new Vehicles_Shops[MAX_VEHICLES_SHOPS][VehiclesShops];
  210.  
  211. enum BuyAbleVehicleInfo{
  212. bvModel,
  213. bvName[32],
  214. bvPrice
  215.  
  216. }
  217. //Buyable vehicles
  218. new buyablevehicles[][BuyAbleVehicleInfo] = {
  219. {400, "Landstalker", 15000},
  220. {401, "Bravura", 10000},
  221. {402, "Buffalo", 70000},
  222. {404, "Perenniel", 8000},
  223. {405, "Sentinel", 30000},
  224. {410, "Manana", 8000},
  225. {411, "Infernus", 80000},
  226. {412, "Voodoo", 25000},
  227. {413, "Pony", 25000},
  228. {415, "Cheetah", 1000000},
  229. {418, "Moonbeam", 25000},
  230. {419, "Esperanto", 30000},
  231. {421, "Washington", 35000},
  232. {422, "Bobcat", 20000},
  233. {424, "BFInjection", 50000},
  234. {426, "Premier", 55000},
  235. {429, "Banshee", 500000},
  236. {436, "Previon", 20000},
  237. {439, "Stallion", 15000},
  238. {440, "Rumpo", 25000},
  239. {445, "Admiral", 30000},
  240. {451, "Turismo", 2000000},
  241. {458, "Solair", 30000},
  242. {461, "PCJ-600", 40000},
  243. {462, "Faggio", 11000},
  244. {463, "Freeway", 25000},
  245. {466, "Glendale", 13000},
  246. {467, "Oceanic", 10000},
  247. {468, "Sanchez", 32000},
  248. {470, "Patriot", 150000},
  249. {471, "Quad", 20000},
  250. {474, "Hermes", 40000},
  251. {475, "Sabre", 45000},
  252. {477, "ZR-350", 1000000},
  253. {478, "Walton", 10000},
  254. {479, "Regina", 38000},
  255. {480, "Comet", 1500000},
  256. {482, "Burrito", 30000},
  257. {489, "Rancher", 50000},
  258. {491, "Virgo", 50000},
  259. {492, "Greenwood", 65000},
  260. {496, "BlistaCompact", 40000},
  261. {500, "Mesa", 52000},
  262. {506, "SuperGT", 1000000},
  263. {507, "Elegant", 65000},
  264. {516, "Nebula", 25000},
  265. {517, "Majestic", 30000},
  266. {518, "Buccaneer", 30000},
  267. {521, "FCR-900", 60000},
  268. {522, "NRG-500", 75000},
  269. {526, "Fortune", 40000},
  270. {527, "Cadrona", 30000},
  271. {526, "Willard", 25000},
  272. {531, "Tractor", 3000},
  273. {533, "Feltzer", 50000},
  274. {534, "Remington", 65000},
  275. {535, "Slamvan", 75000},
  276. {536, "Blade", 60000},
  277. {540, "Vincent", 45000},
  278. {541, "Bullet", 1000000},
  279. {542, "Clover", 18000},
  280. {543, "Sadler", 8000},
  281. {546, "Intruder", 20000},
  282. {547, "Primo", 25000},
  283. {549, "Tampa", 18000},
  284. {550, "Sunrise", 21000},
  285. {551, "Merit", 20000},
  286. {554, "Yosemite", 45000},
  287. {555, "Windsor", 500000},
  288. {558, "Uranus", 650000},
  289. {559, "Jester", 250000},
  290. {560, "Sultan", 150000},
  291. {561, "Stratum", 70000},
  292. {562, "Elegy", 500000},
  293. {565, "Flash", 300000},
  294. {566, "Tahoma", 42000},
  295. {567, "Savanna", 65000},
  296. {603, "Phoenix", 500000},
  297. {602, "Alpha", 300000},
  298. {600, "Picador", 15000},
  299. {589, "Club", 70000},
  300. {587, "Euros", 80000},
  301. {586, "Wayfarer", 24560},
  302. {585, "Emperor", 32000},
  303. {581, "BF-400", 47000},
  304. {580, "Stafford", 150000},
  305. {579, "Huntley", 80000},
  306. {576, "Tornado", 45000},
  307. {575, "Broadway", 500000}
  308. };
  309.  
  310. enum Business_Parameters{
  311. bizName[64],
  312. bizOwner_Name[64],
  313. bizEnter_Fee,
  314. bizOn_Sale,
  315. bizPrice,
  316. bizLocked,
  317. Float:bizEntrance_X,
  318. Float:bizEntrance_Y,
  319. Float:bizEntrance_Z,
  320. Float:bizInterior_X,
  321. Float:bizInterior_Y,
  322. Float:bizInterior_Z,
  323. bizInterior,
  324. Text3D:labelid
  325. }
  326. new Business_Infos[MAX_BUSINESS][Business_Parameters];
  327.  
  328. new HouseCreatingName[MAX_PLAYERS];
  329. new HouseCreatingPrice[MAX_PLAYERS];
  330. enum BankParams{
  331. Float:BankEnterX,
  332. Float:BankEnterY,
  333. Float:BankEnterZ,
  334. Float:BankExitX,
  335. Float:BankExitY,
  336. Float:BankExitZ,
  337. BankInteriorID
  338. }
  339. new BankInfos[MAX_BANKS][BankParams];
  340. enum HouseParams{
  341. Text3D:hTextLabelID,
  342. hPickup_ID,
  343. HouseName[64],
  344. OwnerName[64],
  345. Price,
  346. Locked,
  347. OnSale,
  348. Float:HouseEnterX,
  349. Float:HouseEnterY,
  350. Float:HouseEnterZ,
  351. Float:HouseInteriorX,
  352. Float:HouseInteriorY,
  353. Float:HouseInteriorZ,
  354. HouseInteriorID
  355. }
  356.  
  357. new HouseInfos[MAX_HOUSES][HouseParams];
  358.  
  359. enum Faction_Parameters{
  360. fFaction_Name[64],
  361. fFaction_Type,
  362. fRank_1_Name[64],
  363. fRank_2_Name[64],
  364. fRank_3_Name[64],
  365. fRank_4_Name[64],
  366. fRank_5_Name[64],
  367. fRank_1_Skin,
  368. fRank_2_Skin,
  369. fRank_3_Skin,
  370. fRank_4_Skin,
  371. fRank_5_Skin,
  372. Float:fFaction_HQ_X,
  373. Float:fFaction_HQ_Y,
  374. Float:fFaction_HQ_Z,
  375. Float:fFaction_HQ_Inside_X,
  376. Float:fFaction_HQ_Inside_Y,
  377. Float:fFaction_HQ_Inside_Z,
  378. fFaction_HQ_Inside_Interior
  379. }
  380.  
  381. new Faction_Infos[MAX_FACTIONS][Faction_Parameters];
  382.  
  383. enum Vehicle_Parameters{
  384. vModel_ID,
  385. Float:vx,
  386. Float:vy,
  387. Float:vz,
  388. Float:vFacing_Angle,
  389. vColor_1,
  390. vColor_2,
  391. vFaction,
  392. vFaction_Rank
  393. }
  394.  
  395. new LoadedVehicles[MAX_VEHICLES][Vehicle_Parameters];
  396.  
  397. new PlayerLogedIn[MAX_PLAYERS];
  398.  
  399. enum _Player{
  400. pKey,
  401. pName[128],
  402. pSkin,
  403. pLevel,
  404. pCash,
  405. pBank,
  406. pAdministrator,
  407. pModerator,
  408. pDonator,
  409. pFaction,
  410. pFaction_Rank,
  411. pCK,
  412. pKills,
  413. pDeaths,
  414. pTutorial,
  415. pFines,
  416. pVehicle_1_Key,
  417. pVehicle_1_Color_1,
  418. pVehicle_1_Color_2,
  419. pVehicle_1_Plate,
  420. pVehicle_1_Panel_Status,
  421. pVehicle_1_Doors_Status,
  422. pVehicle_1_Lights_Status,
  423. pVehicle_1_Tires_Status,
  424. Float:pVehicle_1_Health,
  425. pVehicle_1_Fuel,
  426. pVehicle_2_Key,
  427. pVehicle_2_Color_1,
  428. pVehicle_2_Color_2,
  429. pVehicle_2_Plate,
  430. pVehicle_2_Panel_Status,
  431. pVehicle_2_Doors_Status,
  432. pVehicle_2_Lights_Status,
  433. pVehicle_2_Tires_Status,
  434. Float:pVehicle_2_Health,
  435. pVehicle_2_Fuel,
  436. pVehicle_3_Key,
  437. pVehicle_3_Color_1,
  438. pVehicle_3_Color_2,
  439. pVehicle_3_Plate,
  440. pVehicle_3_Panel_Status,
  441. pVehicle_3_Doors_Status,
  442. pVehicle_3_Lights_Status,
  443. pVehicle_3_Tires_Status,
  444. Float:pVehicle_3_Health,
  445. pVehicle_3_Fuel,
  446. pSpawned_Vehicle,
  447. pSpawned_Vehicle_Slot,
  448. Float:pPark_X,
  449. Float:pPark_Y,
  450. Float:pPark_Z,
  451. Float:pPark_FA,
  452. Float:pCrash_X,
  453. Float:pCrash_Y,
  454. Float:pCrash_Z,
  455. Float:pCrash_F,
  456. pCrashed,
  457. Float:pSpawn_X,
  458. Float:pSpawn_Y,
  459. Float:pSpawn_Z,
  460. pInterior,
  461. pInObject,
  462. Float:pObjectEnterX,
  463. Float:pObjectEnterY,
  464. Float:pObjectEnterZ,
  465. Float:pObjectExitX,
  466. Float:pObjectExitY,
  467. Float:pObjectExitZ,
  468. pObjectInterior,
  469. pObjectType,
  470. pHouse_Key,
  471. pWeed,
  472. pCoke,
  473. pLSD,
  474. pPayCheck,
  475. pJob,
  476. pBiz_Key,
  477. pWeapon_1,
  478. pWeapon_1_Ammo,
  479. pWeapon_2,
  480. pWeapon_2_Ammo,
  481. pWeapon_3,
  482. pWeapon_3_Ammo,
  483. pWeapon_4,
  484. pWeapon_4_Ammo,
  485. pWeapon_5,
  486. pWeapon_5_Ammo,
  487. pWeapon_6,
  488. pWeapon_6_Ammo,
  489. pWeapon_7,
  490. pWeapon_7_Ammo,
  491. pWeapon_8,
  492. pWeapon_8_Ammo,
  493. pWeapon_9,
  494. pWeapon_9_Ammo,
  495. pWeapon_10,
  496. pWeapon_10_Ammo,
  497. pWeapon_11,
  498. pWeapon_11_Ammo,
  499. pWeapon_12,
  500. pWeapon_12_Ammo,
  501. pWeapon_13,
  502. pWeapon_13_Ammo,
  503. pMobile_Num,
  504. pMobile_Tog,
  505. pFueling,
  506. pCuffed,
  507. pDraging,
  508. pDragingTimer,
  509. pDragged,
  510. pTazed,
  511. pADuty,
  512. pStealing,
  513. pStealingTimer
  514. }
  515.  
  516. new GlobalType;
  517.  
  518. new Player_Infos[MAX_PLAYERS][_Player];
  519. new Doing_Tutorial[MAX_PLAYERS] = 0;
  520. new pMuted[MAX_PLAYERS] = 0;
  521.  
  522. main(){
  523. printf("Welcome to %s", SERVERNAME);
  524. return 1;
  525. }
  526.  
  527. public OnGameModeInit(){
  528. SetGameModeText(SERVERNAME);
  529. ManualVehicleEngineAndLights();
  530. ShowPlayerMarkers(0);
  531. AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
  532. SetTimer("AntiCheatMoney", 1000, true);
  533. SetTimer("AntiCheatWeapon", 1000, true);
  534. SetTimer("FuelSystem", 30000, true);
  535. SetTimer("SpeedCamsTimer", 1000, true);
  536. DisableInteriorEnterExits();
  537. EnableStuntBonusForAll(0);
  538. OOC_Enabled = true;
  539. LoadJobs();
  540. LoadFactions();
  541. LoadHouses();
  542. LoadBusiness();
  543. LoadVehicleShops();
  544. LoadVehicleSpawns();
  545. Load247();
  546. LoadBanks();
  547. LoadVehicles(1);
  548. LoadMapIcons();
  549. LoadAtms();
  550. LoadSpeedCams();
  551. GlobalType = 0;
  552. return 1;
  553. }
  554. public OnGameModeExit(){
  555. return 1;
  556. }
  557. public OnPlayerRequestSpawn(playerid){
  558. if(PlayerLogedIn[playerid] != 1){
  559. SendClientMessage(playerid, COLOR_RED, "You need to login first.");
  560. return 0;
  561. }else{
  562. return 1;
  563. }
  564. }
  565. public OnPlayerSpawn(playerid){
  566. if(Player_Infos[playerid][pTutorial] == 999){
  567. TutorialStep1(playerid);
  568. return 0;
  569. }
  570. new spawn_string[128];
  571. if(IsPlayerAdministrator(playerid, 1338)){
  572. format(spawn_string, sizeof(spawn_string), "Welcome back owner %s", Player_Infos[playerid][pName]);
  573. SendClientMessage(playerid, COLOR_BLUE, spawn_string);
  574. }
  575. SetPlayerCash(playerid, Player_Infos[playerid][pCash]);
  576. SetPlayerSkin(playerid, Player_Infos[playerid][pSkin]);
  577. SetPlayerPos(playerid, Player_Infos[playerid][pSpawn_X], Player_Infos[playerid][pSpawn_Y], Player_Infos[playerid][pSpawn_Z]);
  578. SetPlayerInterior(playerid, Player_Infos[playerid][pInterior]);
  579. return 1;
  580. }
  581. public OnPlayerRequestClass(playerid, classid){
  582. new Player_Name[128], Account[128], class_req_string[128];
  583. GetPlayerName(playerid, Player_Name, sizeof(Player_Name));
  584. format(Account, sizeof(Account), "Players/%s.ini", Player_Name);
  585. if(dini_Exists(Account)){
  586. format(class_req_string, sizeof(class_req_string), "Welcome %s, please login\n\rType your password bellow.", Player_Name);
  587. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, "Login", class_req_string, "Login", "Close");
  588. return 1;
  589. }else{
  590. format(class_req_string, sizeof(class_req_string), "Welcome %s, please register\n\rType your password bellow.", Player_Name);
  591. ShowPlayerDialog(playerid, 2, 1, "Register", class_req_string, "Register", "Close");
  592. return 1;
  593. }
  594. }
  595. public OnPlayerConnect(playerid){
  596. new WelcomeText[128];
  597. format(WelcomeText, sizeof(WelcomeText), "Welcome to %s", SERVERNAME);
  598. PlayerLogedIn[playerid] = 0;
  599. SendClientMessage(playerid, COLOR_YELLOW, WelcomeText);
  600. OfferedHouse[playerid] = -1;
  601. WrongPassword[playerid] = 0;
  602. ShowSpeedo[playerid] = 0;
  603. SpeedCamPlayer[playerid] = 0;
  604. Player_Infos[playerid][pFueling] = 0;
  605. Player_Infos[playerid][pCuffed] = 0;
  606. Player_Infos[playerid][pDraging] = -1;
  607. Player_Infos[playerid][pDragged] = -1;
  608. Player_Infos[playerid][pTazed] = 0;
  609. Player_Infos[playerid][pADuty] = 0;
  610. Player_Infos[playerid][pStealing] = 0;
  611. SpeedoTimer[playerid] = -1;
  612. return 1;
  613. }
  614. public OnPlayerDisconnect(playerid, reason){
  615. WrongPassword[playerid] = 0;
  616. if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
  617. DestroyVehicle(Player_Infos[playerid][pSpawned_Vehicle]);
  618. }
  619. if(reason == 0){
  620. SaveAccount(Player_Infos[playerid][pName], 1);
  621. return 1;
  622. }
  623. SaveAccount(Player_Infos[playerid][pName], 0);
  624. return 1;
  625. }
  626. public OnPlayerText(playerid, text[]){
  627. if(Doing_Tutorial[playerid] == 1){
  628. SendClientMessage(playerid, COLOR_RED, "No commands available while reading tutorial.");
  629. return 0;
  630. }else if(pMuted[playerid] == 1){
  631. SendClientMessage(playerid, COLOR_RED, "You can not chat, you are muted...");
  632. SendClientMessage(playerid, COLOR_RED, "use /unmuteme to ask admin to unmute you.");
  633. return 0;
  634. }
  635. new String[1024], Name[24];
  636. GetPlayerName(playerid, Name, sizeof(Name));
  637. format(String, sizeof(String), "%s: %s", Name, text);
  638. SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 20, String);
  639. return 0;
  640. }
  641.  
  642. public OnPlayerCommandText(playerid, cmdtext[]){
  643. if(Doing_Tutorial[playerid] == 1){
  644. SendClientMessage(playerid, COLOR_RED, "No commands available while reading tutorial.");
  645. return 1;
  646. }
  647. new idx, cmd[128], tmp[128];
  648. cmd = strtok(cmdtext, idx);
  649. if(!strcmp(cmd, "/addobject", true)){
  650. tmp = strtok(cmdtext, idx);
  651. if(!strlen(tmp)){
  652. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addobject objectid");
  653. return 1;
  654. }
  655. new Float:X, Float:Y, Float:Z, Float:FA;
  656. GetPlayerPos(playerid, X, Y, Z);
  657. GetPlayerFacingAngle(playerid, FA);
  658. new tmpobjid;
  659. tmpobjid = CreateObject(strval(tmp), X, Y, Z+1, 0.0, 0.0, FA);
  660. DestroyObject(tmpobjid);
  661. return 1;
  662. }
  663. if(strcmp(cmd, "/vehid", true) == 0){
  664. if(IsPlayerInAnyVehicle(playerid)){
  665. new vids[128];
  666. format(vids, sizeof(vids), "Vehicle ID: %d", GetPlayerVehicleID(playerid));
  667. SendClientMessage(playerid, COLOR_WHITE, vids);
  668. return 1;
  669. }
  670. }
  671. if(strcmp(cmd, "/credits", true) == 0){
  672. SendClientMessage(playerid, COLOR_YELLOW, "Roleplayer script by CoaPsyFactor, v0.0.1");
  673. return 1;
  674. }else if(strcmp(cmd, "/addjob", true) == 0){
  675. if(IsPlayerAdministrator(playerid, 1338)){
  676. new Job_Name_Create[128], Job_Type_Create, Float:JCX, Float:JCY, Float:JCZ;
  677. tmp = strtok(cmdtext, idx);
  678. if(!strlen(tmp)){
  679. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addjob [Type] [Name]");
  680. return 1;
  681. }
  682. Job_Type_Create = strval(tmp);
  683. tmp = strrest(cmdtext, idx);
  684. if(!strlen(tmp)){
  685. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addjob [Type] [Name]");
  686. return 1;
  687. }
  688. format(Job_Name_Create, sizeof(Job_Name_Create), "%s", tmp);
  689. GetPlayerPos(playerid, JCX, JCY, JCZ);
  690. AddJob(Job_Name_Create, Job_Type_Create, JCX, JCY, JCZ);
  691. return 1;
  692. }
  693. return 1;
  694. }else if(strcmp(cmd, "/loadjobs", true) == 0){
  695. if(IsPlayerAdministrator(playerid, 1338)){
  696. LoadJobs();
  697. return 1;
  698. }
  699. }else if(strcmp(cmd, "/writepos", true) == 0){
  700. if(IsPlayerAdministrator(playerid, 1338)){
  701. new Float:x, Float:y, Float:z, string[128];
  702. GetPlayerPos(playerid, x, y, z);
  703. new File:Cords = fopen("cords.txt", io_append);
  704. format(string, sizeof(string), "%f,%f,%f\n", x, y, z);
  705. fwrite(Cords, string);
  706. fclose(Cords);
  707. return 1;
  708. }
  709. }else if(strcmp(cmd, "/addvehicle", true) == 0){
  710. if(IsPlayerAdministrator(playerid, 1338)){
  711. new ModelID, Float:My_X, Float:My_Y, Float:My_Z, Float:My_Facing_Angle, Color_1, Color_2, Faction, Faction_Rank;
  712. tmp = strtok(cmdtext, idx);
  713. if(!strlen(tmp)){
  714. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model] [color_1] [color_2] [faction] [faction_rank]");
  715. return 1;
  716. }
  717. ModelID = strval(tmp);
  718. tmp = strtok(cmdtext, idx);
  719. if(!strlen(tmp)){
  720. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model] [color_1] [color_2] [faction] [faction_rank]");
  721. return 1;
  722. }
  723. Color_1 = strval(tmp);
  724. tmp = strtok(cmdtext, idx);
  725. if(!strlen(tmp)){
  726. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addvehicle [model] [color_1] [color_2] [faction] [faction_rank]");
  727. return 1;
  728. }
  729. Color_2 = strval(tmp);
  730. tmp = strtok(cmdtext, idx);
  731. if(!strlen(tmp)){
  732. Faction = -1;
  733. }else{
  734. Faction = strval(tmp);
  735. }
  736. tmp = strtok(cmdtext, idx);
  737. if(!strlen(tmp)){
  738. Faction_Rank = -1;
  739. }else{
  740. Faction_Rank = strval(tmp);
  741. }
  742. GetPlayerPos(playerid, My_X, My_Y, My_Z);
  743. GetPlayerFacingAngle(playerid, My_Facing_Angle);
  744. AddVehicle(ModelID, My_X, My_Y, My_Z, My_Facing_Angle, Color_1, Color_2, Faction, Faction_Rank);
  745. return 1;
  746. }
  747. }else if(strcmp(cmd, "/loadvehicles", true) == 0){
  748. if(IsPlayerAdministrator(playerid, 1338)){
  749. CallLocalFunction("LoadVehicles", "d", 0);
  750. return 1;
  751. }
  752. }else if(strcmp(cmd, "/addfaction", true) == 0){
  753. if(IsPlayerAdministrator(playerid, 1338)){
  754. new Type, fName[128];
  755. tmp = strtok(cmdtext, idx);
  756. if(!strlen(tmp)){
  757. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfaction [Type] [Name]");
  758. return 1;
  759. }
  760. Type = strval(tmp);
  761. tmp = strrest(cmdtext, idx);
  762. if(strlen(tmp) < 3){
  763. SendClientMessage(playerid, COLOR_RED, "Faction name must have at least 3 characters");
  764. return 1;
  765. }
  766. format(fName, sizeof(fName), "%s", tmp);
  767. AddFaction(fName, Type);
  768. return 1;
  769. }
  770. }else if(strcmp(cmd, "/setrankname", true) == 0){
  771. if(IsPlayerAdministrator(playerid, 1338)){
  772. new Faction_ID, Rank_ID, rName[128];
  773. tmp = strtok(cmdtext, idx);
  774. if(!strlen(tmp)){
  775. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankname [FactionID] [Rank] [Rank_Name]");
  776. return 1;
  777. }
  778. Faction_ID = strval(tmp);
  779. tmp = strtok(cmdtext, idx);
  780. if(!strlen(tmp)){
  781. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankname [FactionID] [Rank] [Rank_Name]");
  782. return 1;
  783. }
  784. Rank_ID = strval(tmp);
  785. tmp = strrest(cmdtext, idx);
  786. if(strlen(tmp) < 3){
  787. SendClientMessage(playerid, COLOR_RED, "Rank name must have at least 3 characters");
  788. return 1;
  789. }
  790. format(rName, sizeof(rName), "%s", tmp);
  791. SetFactionRankName(Faction_Infos[Faction_ID][fFaction_Name], Rank_ID, rName);
  792. new string[128];
  793. format(string, sizeof(string), "You changed rank name for faction %s and rank %d to %s", Faction_Infos[Faction_ID][fFaction_Name], Rank_ID, rName);
  794. SendClientMessage(playerid, COLOR_YELLOW, string);
  795. return 1;
  796. }
  797. }else if(strcmp(cmd, "/setrankskin", true) == 0){
  798. if(IsPlayerAdministrator(playerid, 1338)){
  799. new Faction_ID, Rank, SkinID, text[128];
  800. tmp = strtok(cmdtext, idx);
  801. if(!strlen(tmp)){
  802. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankskin [Faction_ID] [Rank] [Skin]");
  803. return 1;
  804. }
  805. Faction_ID = strval(tmp);
  806. tmp = strtok(cmdtext, idx);
  807. if(!strlen(tmp)){
  808. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankskin [Faction_ID] [Rank] [Skin]");
  809. return 1;
  810. }
  811. Rank = strval(tmp);
  812. tmp = strtok(cmdtext, idx);
  813. if(!strlen(tmp)){
  814. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setrankskin [Faction_ID] [Rank] [Skin]");
  815. return 1;
  816. }
  817. SkinID = strval(tmp);
  818. SetFactionRankSkin(Faction_Infos[Faction_ID][fFaction_Name], Rank, SkinID);
  819. format(text, sizeof(text), "You set skin %d for faction %s, rank %d", SkinID, Faction_Infos[Faction_ID][fFaction_Name], Rank);
  820. SendClientMessage(playerid, COLOR_YELLOW, text);
  821. return 1;
  822. }
  823. }else if(strcmp(cmd, "/addfactionhq", true) == 0){
  824. if(IsPlayerAdministrator(playerid, 1338)){
  825. new Faction_ID, Float:ix, Float:iy, Float:iz, interior, text[128];
  826. tmp = strtok(cmdtext, idx);
  827. if(!strlen(tmp)){
  828. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
  829. return 1;
  830. }
  831. Faction_ID = strval(tmp);
  832. tmp = strtok(cmdtext, idx);
  833. if(!strlen(tmp)){
  834. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
  835. return 1;
  836. }
  837. ix = floatstr(tmp);
  838. tmp = strtok(cmdtext, idx);
  839. if(!strlen(tmp)){
  840. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
  841. return 1;
  842. }
  843. iy = floatstr(tmp);
  844. tmp = strtok(cmdtext, idx);
  845. if(!strlen(tmp)){
  846. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
  847. return 1;
  848. }
  849. iz = floatstr(tmp);
  850. tmp = strtok(cmdtext, idx);
  851. if(!strlen(tmp)){
  852. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addfactionhq [Faction_ID] [Inside_X] [Inside_Y] [Inside_Z] [Interior]");
  853. return 1;
  854. }
  855. interior = strval(tmp);
  856. AddFactionHQ(Faction_Infos[Faction_ID][fFaction_Name], ix, iy, iz, interior, playerid);
  857. format(text, sizeof(text), "You created HQ for faction %s.", Faction_Infos[Faction_ID][fFaction_Name]);
  858. SendClientMessage(playerid, COLOR_YELLOW, text);
  859. return 1;
  860. }
  861. }else if(strcmp(cmd, "/loadfactions", true) == 0){
  862. if(IsPlayerAdministrator(playerid, 1338)){
  863. LoadFactions();
  864. return 1;
  865. }
  866. }else if(strcmp(cmd, "/factions", true) == 0){
  867. if(Player_Infos[playerid][pAdministrator] >= 1){
  868. new List_String[128];
  869. for(new i = 0; i<sizeof(Faction_Infos); i++){
  870. if(strlen(Faction_Infos[i][fFaction_Name]) >= 3){
  871. format(List_String, sizeof(List_String), "Faction ID %d, Name: %s", i, Faction_Infos[i][fFaction_Name]);
  872. SendClientMessage(playerid, COLOR_YELLOW, List_String);
  873. }
  874. }
  875. return 1;
  876. }
  877. }else if(strcmp(cmd, "/createhouse", true) == 0){
  878. if(IsPlayerAdministrator(playerid, 1338)){
  879. ShowPlayerDialog(playerid, 3, 1, "Create House. Step 1", "House/Street Name:", "Next", "Exit");
  880. return 1;
  881. }
  882. }else if(strcmp(cmd, "/enter", true) == 0){
  883. PutPlayerInObject(playerid);
  884. }else if(strcmp(cmd, "/exit", true) == 0){
  885. RemovePlayerFromObject(playerid);
  886. }else if(strcmp(cmd, "/fill", true) == 0){
  887. new VehID, Fuel, gsid, money;
  888. if(!IsPlayerInAnyVehicle(playerid)){
  889. SendClientMessage(playerid, COLOR_RED, "You are not in vehicle");
  890. return 1;
  891. }
  892. if(!IsPlayerNearGasStation(playerid, gsid)){
  893. SendClientMessage(playerid, COLOR_RED, "You are not at gas station.");
  894. return 1;
  895. }
  896. VehID = GetPlayerVehicleID(playerid);
  897. Fuel = 100 - VehicleFuel[VehID];
  898. money = (Fuel * 3) * GasStations[gsid][gssrate];
  899. if(money > GetPlayerCash(playerid)){
  900. SendClientMessage(playerid, COLOR_RED, "You need more money to fill your vehicle.");
  901. return 1;
  902. }
  903. if(Fuel){
  904. Player_Infos[playerid][pFueling] = 1;
  905. ToggleVehicleEngine(VehID, 0);
  906. GameTextForPlayer(playerid, "~y~Fueling..... ~g~Please wait...", 10000, 5);
  907. SetTimerEx("Fueling", 10000, false, "ddd", playerid, VehID, money);
  908. return 1;
  909. }else{
  910. SendClientMessage(playerid, COLOR_YELLOW, "You vehicle is full.");
  911. return 1;
  912. }
  913. }else if(strcmp(cmd, "/fixcar", true) == 0){
  914. if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT){
  915. SendClientMessage(playerid, COLOR_RED, "You need to be on foot to fix car.");
  916. return 1;
  917. }
  918. if(IsUsableCommand(0, GetJobType(playerid), "/fixcar")){
  919. new VehID, Float:Health, Time;
  920. if(GetNearestVehicleID(playerid, 2.0, VehID)){
  921. GetVehicleHealth(VehID, Health);
  922. Health = Health / 10;
  923. if(Health >= 100){
  924. SendClientMessage(playerid, COLOR_YELLOW, "This vehicle doesn't need fix.");
  925. return 1;
  926. }
  927. Time = 100 - floatround(Health);
  928. ApplyAnimation(playerid, "CAR", "Fixn_Car_Loop", 1, 1, 0, 0, 0, Time * 1000, 1);
  929. GameTextForPlayer(playerid, "Fixing vehicle...", Time * 1000, 3);
  930. SetTimerEx("FixVehicle", Time * 1000, false, "dd", playerid, VehID);
  931. return 1;
  932. }else{
  933. SendClientMessage(playerid, COLOR_RED, "No vehicles near...");
  934. return 1;
  935. }
  936. }else{
  937. SendClientMessage(playerid, COLOR_RED, "You can't use this command.");
  938. return 1;
  939. }
  940. }else if(strcmp(cmd, "/job", true) == 0){
  941. new JobID;
  942. if(Player_Infos[playerid][pJob] != 255){
  943. SendClientMessage(playerid, COLOR_RED, "You already have job.");
  944. return 1;
  945. }
  946. if(IsPlayerNearJob(playerid, JobID)){
  947. new str[128];
  948. Player_Infos[playerid][pJob] = JobID;
  949. format(str, sizeof(str), "You got new job. %s", Job_Infos[JobID][jName]);
  950. SendClientMessage(playerid, COLOR_GREEN, str);
  951. return 1;
  952. }
  953. }else if(strcmp(cmd, "/cuff", true) == 0){
  954. new Type, Rank;
  955. GetPlayerFactionInfos(playerid, Type, Rank);
  956. if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
  957. new ID, String[128];
  958. tmp = strtok(cmdtext, idx);
  959. if(!strlen(tmp)){
  960. SendClientMessage(playerid, COLOR_GREY, "USAGE: /cuff [PlayerID]");
  961. return 1;
  962. }
  963. ID = strval(tmp);
  964. if(!IsPlayerConnected(ID) || ID == playerid){
  965. SendClientMessage(playerid, COLOR_RED, "Inactive ID");
  966. return 1;
  967. }
  968. if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
  969. SendClientMessage(playerid, COLOR_RED, "Player must be near you.");
  970. return 1;
  971. }
  972. if(Player_Infos[ID][pCuffed] == 0){
  973. format(String, sizeof(String), "You cuffed %s.", Player_Infos[ID][pName]);
  974. SendClientMessage(playerid, COLOR_YELLOW, String);
  975. format(String, sizeof(String), "%s cuffed you.", Player_Infos[playerid][pName]);
  976. SendClientMessage(ID, COLOR_BLUE, String);
  977. Player_Infos[ID][pCuffed] = 1;
  978. TogglePlayerControllable(ID, 0);
  979. return 1;
  980. }else{
  981. format(String, sizeof(String), "You released %s.", Player_Infos[ID][pName]);
  982. SendClientMessage(playerid, COLOR_YELLOW, String);
  983. format(String, sizeof(String), "%s released you.", Player_Infos[playerid][pName]);
  984. SendClientMessage(ID, COLOR_BLUE, String);
  985. Player_Infos[ID][pCuffed] = 0;
  986. TogglePlayerControllable(ID, 1);
  987. return 1;
  988. }
  989. }
  990. }else if(strcmp(cmd, "/handsup", true) == 0){
  991. if(!IsPlayerInAnyVehicle(playerid)){
  992. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_HANDSUP);
  993. return 1;
  994. }
  995. }else if(strcmp(cmd, "/drag", true) == 0){
  996. new Type, Rank, ID, str[128];
  997. GetPlayerFactionInfos(playerid, Type, Rank);
  998. if(IsUsableCommand(Rank, Type, cmd)|| IsPlayerAdministrator(playerid, 1338)){
  999. tmp = strtok(cmdtext, idx);
  1000. if(!strlen(tmp)){
  1001. SendClientMessage(playerid, COLOR_GREY, "USAGE: /drag [PlayerID]");
  1002. return 1;
  1003. }
  1004. ID = strval(tmp);
  1005. if(!IsPlayerConnected(ID) || playerid == ID){
  1006. SendClientMessage(playerid, COLOR_RED, "InactiveID");
  1007. return 1;
  1008. }
  1009. if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
  1010. SendClientMessage(playerid, COLOR_RED, "You must ne near player.");
  1011. return 1;
  1012. }
  1013. if(Player_Infos[ID][pTazed] == 0 && Player_Infos[ID][pCuffed] == 0 && GetPlayerSpecialAction(ID) != SPECIAL_ACTION_HANDSUP){
  1014. SendClientMessage(playerid, COLOR_RED, "Player must be tazed/cuffed/handsup if you want to drag him.");
  1015. return 1;
  1016. }
  1017. Player_Infos[ID][pCuffed] = 1;
  1018. format(str, sizeof(str), "You are draging %s", Player_Infos[ID][pName]);
  1019. SendClientMessage(playerid, COLOR_YELLOW, str);
  1020. format(str, sizeof(str), "%s is draging you.", Player_Infos[playerid][pName]);
  1021. SendClientMessage(ID, COLOR_BLUE, str);
  1022. Player_Infos[playerid][pDraging] = ID;
  1023. Player_Infos[ID][pDragged] = playerid;
  1024. TogglePlayerControllable(ID, 0);
  1025. Player_Infos[playerid][pDragingTimer] = SetTimerEx("DragPlayer", 1000, true, "dd", playerid, ID);
  1026. return 1;
  1027. }
  1028. }else if(strcmp(cmd, "/stopdrag", true) == 0){
  1029. new Type, Rank, ID, str[128];
  1030. GetPlayerFactionInfos(playerid, Type, Rank);
  1031. if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
  1032. ID = Player_Infos[playerid][pDraging];
  1033. if(Player_Infos[playerid][pDraging] != -1 && Player_Infos[ID][pDragged] == playerid){
  1034. if(!Player_Infos[ID][pCuffed]){
  1035. TogglePlayerControllable(ID, 1);
  1036. }
  1037. Player_Infos[playerid][pDraging] = -1;
  1038. Player_Infos[ID][pDragged] = -1;
  1039. KillTimer(Player_Infos[playerid][pDragingTimer]);
  1040. format(str, sizeof(str), "You released %s", Player_Infos[ID][pName]);
  1041. SendClientMessage(playerid, COLOR_YELLOW, str);
  1042. format(str, sizeof(str), "%s released you", Player_Infos[playerid][pName]);
  1043. SendClientMessage(ID, COLOR_BLUE, str);
  1044. return 1;
  1045. }
  1046. }
  1047. }else if(strcmp(cmd, "/detain", true) == 0){
  1048. new Type, Rank, VehID, Seat, str[128], ID;
  1049. GetPlayerFactionInfos(playerid, Type, Rank);
  1050. if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
  1051. ID = Player_Infos[playerid][pDraging];
  1052. if(ID == -1){
  1053. SendClientMessage(playerid, COLOR_RED, "You are not draging anyone.");
  1054. return 1;
  1055. }
  1056. if(GetNearestVehicleID(playerid, 2.5, VehID)){
  1057. if(!IsFreeSeat(VehID, 2) && !IsFreeSeat(VehID, 3)){
  1058. SendClientMessage(playerid, COLOR_RED, "Back seat already used.");
  1059. return 1;
  1060. }
  1061. if(IsFreeSeat(VehID, 2)){
  1062. Seat = 2;
  1063. }
  1064. if(IsFreeSeat(VehID, 3)){
  1065. Seat = 3;
  1066. }
  1067. KillTimer(Player_Infos[playerid][pDragingTimer]);
  1068. PutPlayerInVehicle(Player_Infos[playerid][pDraging], VehID, Seat);
  1069. TogglePlayerControllable(ID, 0);
  1070. format(str, sizeof(str), "You placed %s into a car.", Player_Infos[ID][pName]);
  1071. SendClientMessage(playerid, COLOR_YELLOW, str);
  1072. format(str, sizeof(str), "%s placed you into a car.", Player_Infos[playerid][pName]);
  1073. SendClientMessage(ID, COLOR_YELLOW, str);
  1074. return 1;
  1075. }
  1076. }
  1077. }else if(strcmp(cmd, "/takeout", true) == 0){
  1078. new Type, Rank, ID;
  1079. ID = Player_Infos[playerid][pDraging];
  1080. GetPlayerFactionInfos(playerid, Type, Rank);
  1081. if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
  1082. if(ID != -1){
  1083. RemovePlayerFromVehicle(Player_Infos[playerid][pDraging]);
  1084. Player_Infos[playerid][pDragingTimer] = SetTimerEx("DragPlayer", 1000, true, "dd", playerid, ID);
  1085. return 1;
  1086. }
  1087. }
  1088. }else if(strcmp(cmd, "/taze", true) == 0){
  1089. new Type, Rank, ID, str[128];
  1090. GetPlayerFactionInfos(playerid, Type, Rank);
  1091. if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
  1092. tmp = strtok(cmdtext, idx);
  1093. if(!strlen(tmp)){
  1094. SendClientMessage(playerid, COLOR_GREY, "USAGE: /taze [PlayerID]");
  1095. return 1;
  1096. }
  1097. ID = strval(tmp);
  1098. if(!IsPlayerConnected(ID) || playerid == ID){
  1099. SendClientMessage(playerid, COLOR_RED, "Invalid ID");
  1100. return 1;
  1101. }
  1102. if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
  1103. SendClientMessage(playerid, COLOR_RED, "You must be near that player.");
  1104. return 1;
  1105. }
  1106. Player_Infos[ID][pTazed] = 1;
  1107. TogglePlayerControllable(ID, 0);
  1108. SetTimerEx("TazePlayer", 10000, false, "d", ID);
  1109. format(str, sizeof(str), "You tazed %s.", Player_Infos[ID][pName]);
  1110. SendClientMessage(playerid, COLOR_YELLOW, str);
  1111. format(str, sizeof(str), "%s tazed you.", Player_Infos[playerid][pName]);
  1112. SendClientMessage(ID, COLOR_YELLOW, str);
  1113. return 1;
  1114. }
  1115. }else if(!strcmp(cmd, "/heal", true)){
  1116. new Type, Rank, ID, str[128];
  1117. GetPlayerFactionInfos(playerid, Type, Rank);
  1118. if(IsUsableCommand(Rank, Type, cmd) || IsPlayerAdministrator(playerid, 1338)){
  1119. tmp = strtok(cmdtext, idx);
  1120. if(!strlen(tmp)){
  1121. SendClientMessage(playerid, COLOR_GREY, "USAGE: /heal [playerid]");
  1122. return 1;
  1123. }
  1124. ID = strval(tmp);
  1125. if(!IsPlayerConnected(ID) || playerid == ID){
  1126. SendClientMessage(playerid, COLOR_RED, "Invalid ID");
  1127. return 1;
  1128. }
  1129. if(!IsPlayerNearPlayer(playerid, ID, 2.0)){
  1130. SendClientMessage(playerid, COLOR_RED, "You must be near player.");
  1131. return 1;
  1132. }
  1133. SetPlayerHealth(playerid, 100.0);
  1134. format(str, sizeof(str), "**%s healed %s**", Player_Infos[playerid][pName], Player_Infos[ID][pName]);
  1135. SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 20, str);
  1136. format(str, sizeof(str), "You healed %s.", Player_Infos[ID][pName]);
  1137. SendClientMessage(playerid, COLOR_YELLOW, str);
  1138. format(str, sizeof(str), "%s healed you.", Player_Infos[playerid][pName]);
  1139. SendClientMessage(ID, COLOR_YELLOW, str);
  1140. return 1;
  1141. }
  1142. }else if(!strcmp(cmd, "/aduty", true)){
  1143. if(IsPlayerAdministrator(playerid, 1)){
  1144. new str[128];
  1145. Player_Infos[playerid][pADuty] = abs(Player_Infos[playerid][pADuty] - 1);
  1146. if(Player_Infos[playerid][pADuty]){
  1147. format(str, sizeof(str), "Administrator %s(%d) is now on duty.", Player_Infos[playerid][pName], playerid);
  1148. }else{
  1149. format(str, sizeof(str), "Administrator %s(%d) is now off duty.", Player_Infos[playerid][pName], playerid);
  1150. }
  1151. SendClientMessageToAll(COLOR_GREEN, str);
  1152. return 1;
  1153. }
  1154. }else if(!strcmp(cmd, "/admins", true)){
  1155. new str[128];
  1156. for(new i = 0; i < MAX_PLAYERS; i++){
  1157. if(IsPlayerConnected(i) && IsPlayerAdministrator(i, 1)){
  1158. switch(Player_Infos[i][pADuty]){
  1159. case 1:{
  1160. format(str, sizeof(str), "%s(%d) on duty.", Player_Infos[i][pName], i);
  1161. SendClientMessage(playerid, COLOR_GREEN, str);
  1162. }
  1163. default:{
  1164. format(str, sizeof(str), "%s(%d) off duty.", Player_Infos[i][pName], i);
  1165. SendClientMessage(playerid, COLOR_GREY, str);
  1166. }
  1167. }
  1168. }
  1169. }
  1170. return 1;
  1171. }else if(strcmp(cmd, "/goto", true) == 0){
  1172. new Choise[12], ID, str[128], Float:X, Float:Y, Float:Z, inter, vw;
  1173. if(!IsPlayerAdministrator(playerid, 1338)){
  1174. return 1;
  1175. }
  1176. tmp = strtok(cmdtext, idx);
  1177. if(!strlen(tmp)){
  1178. SendClientMessage(playerid, COLOR_GREY, "USAGE: /goto [player/car/house/biz/faction/job/gasstaion/247store/bank] [id]");
  1179. return 1;
  1180. }
  1181. format(Choise, sizeof(Choise), "%s", tmp);
  1182. tmp = strtok(cmdtext, idx);
  1183. if(!strlen(tmp)){
  1184. format(str, sizeof(str), "USAGE: /goto %s [id]", Choise);
  1185. SendClientMessage(playerid, COLOR_GREY, str);
  1186. return 1;
  1187. }
  1188. ID = strval(tmp);
  1189. if(!strcmp(Choise, "player", true)){
  1190. if(!IsPlayerConnected(ID) || playerid == ID){
  1191. SendClientMessage(playerid, COLOR_RED, "Invalid ID");
  1192. return 1;
  1193. }
  1194. GetPlayerPos(ID, X, Y, Z);
  1195. GetDirectedXY(1, ID, X, Y, 2.0, 1);
  1196. inter = GetPlayerInterior(ID);
  1197. vw = GetPlayerVirtualWorld(ID);
  1198. SetPlayerInterior(playerid, inter);
  1199. SetPlayerVirtualWorld(playerid, vw);
  1200. SetPlayerPos(playerid, X, Y, Z);
  1201. format(str, sizeof(str), "You teleported to %s", Player_Infos[ID][pName]);
  1202. SendClientMessage(playerid, COLOR_PURPLE, str);
  1203. format(str, sizeof(str), "Administrator %s teleported to you", Player_Infos[playerid][pName]);
  1204. SendClientMessage(playerid, COLOR_PURPLE, str);
  1205. return 1;
  1206. }else if(!strcmp(Choise, "car", true)){
  1207. if(!IsValidVehicle(ID)){
  1208. SendClientMessage(playerid, COLOR_RED, "Invalid Vehicle ID");
  1209. return 1;
  1210. }
  1211. GetVehiclePos(ID, X, Y, Z);
  1212. vw = GetVehicleVirtualWorld(ID);
  1213. SetPlayerVirtualWorld(playerid, vw);
  1214. SetPlayerPos(playerid, X, Y, Z+1.3);
  1215. return 1;
  1216. }else if(!strcmp(Choise, "house", true)){
  1217. if(!strlen(HouseInfos[ID][HouseName])){
  1218. SendClientMessage(playerid, COLOR_RED, "Invalid House ID");
  1219. return 1;
  1220. }
  1221. format(str, sizeof(str), "You have teleported to house %s(%d)", HouseInfos[ID][HouseName], ID);
  1222. SendClientMessage(playerid, COLOR_PURPLE, str);
  1223. SetPlayerPos(playerid, HouseInfos[ID][HouseEnterX], HouseInfos[ID][HouseEnterY], HouseInfos[ID][HouseEnterZ]);
  1224. return 1;
  1225. }else if(!strcmp(Choise, "biz", true)){
  1226. if(!strlen(Business_Infos[ID][bizName])){
  1227. SendClientMessage(playerid, COLOR_RED, "Invalid Business ID");
  1228. return 1;
  1229. }
  1230. format(str, sizeof(str), "You have teleported to business %s(%d)", Business_Infos[ID][bizName], ID);
  1231. SendClientMessage(playerid, COLOR_PURPLE, str);
  1232. SetPlayerPos(playerid, Business_Infos[ID][bizEntrance_X], Business_Infos[ID][bizEntrance_Y], Business_Infos[ID][bizEntrance_Z]);
  1233. return 1;
  1234. }else if(!strcmp(Choise, "faction", true)){
  1235. if(!strlen(Faction_Infos[ID][fFaction_Name])){
  1236. SendClientMessage(playerid, COLOR_RED, "Invalid Faction ID");
  1237. return 1;
  1238. }
  1239. format(str, sizeof(str), "You have teleported to faction %s(%d)", Faction_Infos[ID][fFaction_Name], ID);
  1240. SendClientMessage(playerid, COLOR_PURPLE, str);
  1241. SetPlayerPos(playerid, Faction_Infos[ID][fFaction_HQ_X], Faction_Infos[ID][fFaction_HQ_Y], Faction_Infos[ID][fFaction_HQ_Z]);
  1242. return 1;
  1243. }else if(!strcmp(Choise, "job", true)){
  1244. if(!strlen(Job_Infos[ID][jName])){
  1245. SendClientMessage(playerid, COLOR_RED, "Invalid Job ID");
  1246. return 1;
  1247. }
  1248. format(str, sizeof(str), "You have teleported to job %s(%d)", Job_Infos[ID][jName], ID);
  1249. SendClientMessage(playerid, COLOR_PURPLE, str);
  1250. SetPlayerPos(playerid, Job_Infos[ID][jPos_X], Job_Infos[ID][jPos_Y], Job_Infos[ID][jPos_Z]);
  1251. return 1;
  1252. }else if(!strcmp(Choise, "gasstation", true)){
  1253. if(!strlen(GasStations[ID][gssname])){
  1254. SendClientMessage(playerid, COLOR_RED, "Invalid Job ID");
  1255. return 1;
  1256. }
  1257. format(str, sizeof(str), "You have teleported to gasstation %s(%d)", GasStations[ID][gssname], ID);
  1258. SendClientMessage(playerid, COLOR_PURPLE, str);
  1259. SetPlayerPos(playerid, GasStations[ID][gssx], GasStations[ID][gssy], GasStations[ID][gssz]);
  1260. return 1;
  1261. }
  1262. }else if(!strcmp(cmd, "/gethere", true)){
  1263. if(IsPlayerAdministrator(playerid, 1)){
  1264. new Float:X, Float:Y, Float:Z, ID, inter, vw, str[128];
  1265. tmp = strtok(cmdtext, idx);
  1266. if(!strlen(tmp)){
  1267. SendClientMessage(playerid, COLOR_GREY, "USAGE: /gethere [playerid]");
  1268. return 1;
  1269. }
  1270. ID = strval(tmp);
  1271. if(!IsPlayerConnected(ID) || playerid == ID){
  1272. SendClientMessage(playerid, COLOR_RED, "Invalid ID");
  1273. return 1;
  1274. }
  1275. GetPlayerPos(playerid, X, Y, Z);
  1276. inter = GetPlayerInterior(playerid);
  1277. vw = GetPlayerVirtualWorld(playerid);
  1278. GetDirectedXY(1, ID, X, Y, 2.0, 1);
  1279. SetPlayerVirtualWorld(ID, vw);
  1280. SetPlayerInterior(ID, inter);
  1281. SetPlayerPos(ID, X, Y, Z);
  1282. format(str, sizeof(str), "You teleported %s(%d) to your position.", Player_Infos[ID][pName], ID);
  1283. SendClientMessage(playerid, COLOR_PURPLE, str);
  1284. format(str, sizeof(str), "Administrator %s(%d) teleported you to their position.", Player_Infos[playerid][pName], playerid);
  1285. SendClientMessage(ID, COLOR_PURPLE, str);
  1286. return 1;
  1287. }
  1288. }else if(strcmp(cmd, "/giveadmin", true) == 0){
  1289. new ID, Level, str[128];
  1290. if(IsPlayerAdministrator(playerid, 1338)){
  1291. tmp = strtok(cmdtext, idx);
  1292. if(!strlen(tmp)){
  1293. SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveadmin [PlayerID] [Level]");
  1294. return 1;
  1295. }
  1296. ID = strval(tmp);
  1297. if(!IsPlayerConnected(ID) || playerid == ID){
  1298. SendClientMessage(playerid, COLOR_RED, "Inactive ID");
  1299. return 1;
  1300. }
  1301. tmp = strtok(cmdtext, idx);
  1302. if(!strlen(tmp)){
  1303. SendClientMessage(playerid, COLOR_GREY, "USAGE: /giveadmin [PlayerID] [Level]");
  1304. return 1;
  1305. }
  1306. Level = strval(tmp);
  1307. Player_Infos[ID][pAdministrator] = Level;
  1308. format(str, sizeof(str), "You set admin level %d to player %s(%d)", Level, Player_Infos[ID][pName], ID);
  1309. SendClientMessage(playerid, COLOR_YELLOW, str);
  1310. format(str, sizeof(str), "Administrator %s(%d) set your admin level to %d", Player_Infos[playerid][pName], playerid, Level);
  1311. SendClientMessage(ID, COLOR_GREEN, str);
  1312. return 1;
  1313. }
  1314. }else if(strcmp(cmd, "/loadhouses", true) == 0){
  1315. if(IsPlayerAdministrator(playerid, 1338)){
  1316. LoadHouses();
  1317. return 1;
  1318. }
  1319. }else if(strcmp(cmd, "/createmapicon", true) == 0){
  1320. if(IsPlayerAdministrator(playerid, 1338)){
  1321. new Icon_Type;
  1322. tmp = strtok(cmdtext, idx);
  1323. if(!strlen(tmp)){
  1324. SendClientMessage(playerid, COLOR_GREY, "USAGE: /createmapicon [Icon]");
  1325. return 1;
  1326. }
  1327. Icon_Type = strval(tmp);
  1328. AddMapIcon(playerid, Icon_Type);
  1329. LoadMapIcons();
  1330. return 1;
  1331. }
  1332. }else if(strcmp(cmd, "/addbiz", true) == 0){
  1333. if(IsPlayerAdministrator(playerid, 1338)){
  1334. new Biz_Name[128], Biz_Price, Float:IntX, Float:IntY, Float:IntZ, Int, Biz_String[128];
  1335. tmp = strtok(cmdtext, idx);
  1336. if(!strlen(tmp)){
  1337. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
  1338. return 1;
  1339. }
  1340. format(Biz_Name, sizeof(Biz_Name), "%s", tmp);
  1341. tmp = strtok(cmdtext, idx);
  1342. if(!strlen(tmp)){
  1343. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
  1344. return 1;
  1345. }
  1346. Biz_Price = strval(tmp);
  1347. tmp = strtok(cmdtext, idx);
  1348. if(!strlen(tmp)){
  1349. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
  1350. return 1;
  1351. }
  1352. IntX = floatstr(tmp);
  1353. tmp = strtok(cmdtext, idx);
  1354. if(!strlen(tmp)){
  1355. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
  1356. return 1;
  1357. }
  1358. IntY = floatstr(tmp);
  1359. tmp = strtok(cmdtext, idx);
  1360. if(!strlen(tmp)){
  1361. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
  1362. return 1;
  1363. }
  1364. IntZ = floatstr(tmp);
  1365. tmp = strtok(cmdtext, idx);
  1366. if(!strlen(tmp)){
  1367. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addbiz [Business_Name] [Price] [Interior_X] [Interior_Y] [Interior_Z] [Interior]");
  1368. return 1;
  1369. }
  1370. Int = strval(tmp);
  1371. AddBusiness(playerid, Biz_Name, "For_Sale", 0, 1, Biz_Price, 1, IntX, IntY, IntZ, Int);
  1372. format(Biz_String, sizeof(Biz_String), "You created business %s", Biz_Name);
  1373. SendClientMessage(playerid, COLOR_YELLOW, Biz_String);
  1374. return 1;
  1375. }
  1376. }else if(strcmp(cmd, "/loadbusiness", true) == 0){
  1377. if(IsPlayerAdministrator(playerid, 1338)){
  1378. LoadBusiness();
  1379. return 1;
  1380. }
  1381. }else if(!strcmp(cmd, "/engine", true) || !strcmp(cmd, "/e", true)){
  1382. new VehicleID;
  1383. if(IsPlayerInAnyVehicle(playerid)){
  1384. if(Player_Infos[playerid][pFueling] == 1){
  1385. SendClientMessage(playerid, COLOR_RED, "You can not start engine, fueling...");
  1386. return 1;
  1387. }
  1388. VehicleID = GetPlayerVehicleID(playerid);
  1389. new engine, lights, alarm, doors, bonnet, boot, objective;
  1390. GetVehicleParamsEx(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
  1391. if(engine == 0){
  1392. if(VehicleFuel[VehicleID] == 0){
  1393. SendClientMessage(playerid, COLOR_YELLOW, "No fuel, you cant start engine.");
  1394. return 1;
  1395. }
  1396. GameTextForPlayer(playerid, "~b~Starting engine", 2000, 5);
  1397. SetTimerEx("SwitchEngineOn", 2000, false, "dd", playerid, VehicleID);
  1398. }else{
  1399. ToggleVehicleEngine(VehicleID, 0);
  1400. }
  1401. return 1;
  1402. }
  1403. }else if(strcmp(cmd, "/lights", true) == 0){
  1404. new engine, lights, alarm, doors, bonnet, boot, objective;
  1405. new PlayerVehicle = GetPlayerVehicleID(playerid);
  1406. GetVehicleParamsEx(PlayerVehicle, engine, lights, alarm, doors, bonnet, boot, objective);
  1407. if(lights == 1){
  1408. SetVehicleParamsEx(PlayerVehicle, engine, 0, alarm, doors, bonnet, boot, objective);
  1409. }else{
  1410. SetVehicleParamsEx(PlayerVehicle, engine, 1, alarm, doors, bonnet, boot, objective);
  1411. }
  1412. return 1;
  1413. }else if(strcmp(cmd, "/mycars", true) == 0){
  1414. new Vehicle_1[30], Vehicle_2[30], Vehicle_3[30], Spawned, MyCarsString[128];
  1415. if(Player_Infos[playerid][pVehicle_1_Key] != 999){
  1416. for(new v1 = 0; v1 < sizeof(buyablevehicles); v1++){
  1417. if(buyablevehicles[v1][bvModel] == Player_Infos[playerid][pVehicle_1_Key]){
  1418. format(Vehicle_1, sizeof(Vehicle_1), "%s", buyablevehicles[v1][bvName]);
  1419. }
  1420. }
  1421. }else{
  1422. format(Vehicle_1, sizeof(Vehicle_1), "None");
  1423. }
  1424. if(Player_Infos[playerid][pVehicle_2_Key] != 999){
  1425. for(new v2 = 0; v2 < sizeof(buyablevehicles); v2++){
  1426. if(buyablevehicles[v2][bvModel] == Player_Infos[playerid][pVehicle_2_Key]){
  1427. format(Vehicle_2, sizeof(Vehicle_2), "%s", buyablevehicles[v2][bvName]);
  1428. }
  1429. }
  1430. }else{
  1431. format(Vehicle_2, sizeof(Vehicle_2), "None");
  1432. }
  1433. if(Player_Infos[playerid][pVehicle_3_Key] != 999){
  1434. for(new v3 = 0; v3 < sizeof(buyablevehicles); v3++){
  1435. if(buyablevehicles[v3][bvModel] == Player_Infos[playerid][pVehicle_3_Key]){
  1436. format(Vehicle_3, sizeof(Vehicle_3), "%s", buyablevehicles[v3][bvName]);
  1437. }
  1438. }
  1439. }else{
  1440. format(Vehicle_3, sizeof(Vehicle_3), "None");
  1441. }
  1442. if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
  1443. Spawned = Player_Infos[playerid][pSpawned_Vehicle];
  1444. }
  1445. format(MyCarsString, sizeof(MyCarsString), "Slot 1: %s, Slot 2: %s, Slot 3: %s, Spawned ID: %d", Vehicle_1, Vehicle_2, Vehicle_3, Spawned);
  1446. SendClientMessage(playerid, COLOR_YELLOW, MyCarsString);
  1447. return 1;
  1448. }else if(strcmp(cmd, "/v", true) == 0 || strcmp(cmd, "/vehicle", true) == 0){
  1449. new Player_Vehicle_ID = GetPlayerVehicleID(playerid);
  1450. new Option[128];
  1451. tmp = strtok(cmdtext, idx);
  1452. if(!strlen(tmp)){
  1453. SendClientMessage(playerid, COLOR_GREY, "USAGE: /v [get/park/lock/save/paint/buy/sell/accept]");
  1454. return 1;
  1455. }
  1456. format(Option, sizeof(Option), "%s", tmp);
  1457. if(strcmp(Option, "get", true) == 0){
  1458. if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
  1459. SendClientMessage(playerid, COLOR_BLUE, "You have already spawned a vehicle.\n Please park it firs.");
  1460. return 1;
  1461. }
  1462. tmp = strtok(cmdtext, idx);
  1463. if(!strval(tmp) || strval(tmp) < 1 && strval(tmp) > 3){
  1464. SendClientMessage(playerid, COLOR_GREY, "USAGE: /v get [Slot_ID(1,2,3)]");
  1465. return 1;
  1466. }
  1467. new PlateID;
  1468. switch(strval(tmp)){
  1469. case 1:{
  1470. if(Player_Infos[playerid][pVehicle_1_Key] == 999){
  1471. SendClientMessage(playerid, COLOR_RED, "You don't have vehicle in that slot.");
  1472. return 1;
  1473. }
  1474. Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(Player_Infos[playerid][pVehicle_1_Key], Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z],Player_Infos[playerid][pPark_FA], Player_Infos[playerid][pVehicle_1_Color_1], Player_Infos[playerid][pVehicle_1_Color_2], -1);
  1475. UpdateVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Panel_Status], Player_Infos[playerid][pVehicle_1_Doors_Status], Player_Infos[playerid][pVehicle_1_Lights_Status], Player_Infos[playerid][pVehicle_1_Tires_Status]);
  1476. SetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Health]);
  1477. PlateID = Player_Infos[playerid][pVehicle_1_Plate];
  1478. VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = Player_Infos[playerid][pVehicle_1_Fuel];
  1479. }
  1480. case 2:{
  1481. if(Player_Infos[playerid][pVehicle_2_Key] == 999){
  1482. SendClientMessage(playerid, COLOR_RED, "You don't have vehicle in that slot.");
  1483. return 1;
  1484. }
  1485. Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(Player_Infos[playerid][pVehicle_2_Key], Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z],Player_Infos[playerid][pPark_FA], Player_Infos[playerid][pVehicle_2_Color_1], Player_Infos[playerid][pVehicle_2_Color_2], -1);
  1486. UpdateVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Panel_Status], Player_Infos[playerid][pVehicle_2_Doors_Status], Player_Infos[playerid][pVehicle_2_Lights_Status], Player_Infos[playerid][pVehicle_2_Tires_Status]);
  1487. SetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Health]);
  1488. PlateID = Player_Infos[playerid][pVehicle_2_Plate];
  1489. VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = Player_Infos[playerid][pVehicle_2_Fuel];
  1490. }
  1491. case 3:{
  1492. if(Player_Infos[playerid][pVehicle_3_Key] == 999){
  1493. SendClientMessage(playerid, COLOR_RED, "You don't have vehicle in that slot.");
  1494. return 1;
  1495. }
  1496. Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(Player_Infos[playerid][pVehicle_3_Key], Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z],Player_Infos[playerid][pPark_FA], Player_Infos[playerid][pVehicle_3_Color_1], Player_Infos[playerid][pVehicle_3_Color_2], -1);
  1497. UpdateVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Panel_Status], Player_Infos[playerid][pVehicle_3_Doors_Status], Player_Infos[playerid][pVehicle_3_Lights_Status], Player_Infos[playerid][pVehicle_3_Tires_Status]);
  1498. SetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Health]);
  1499. PlateID = Player_Infos[playerid][pVehicle_3_Plate];
  1500. VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = Player_Infos[playerid][pVehicle_3_Fuel];
  1501. }
  1502. }
  1503. Player_Infos[playerid][pSpawned_Vehicle_Slot] = strval(tmp);
  1504. SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], 0, 0, 0, 0, 0, 0, 0);
  1505. SetVehicleZAngle(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pPark_FA]);
  1506. new Plate[64];
  1507. format(Plate, sizeof(Plate), "LH-%d", PlateID);
  1508. SetVehicleNumberPlate(Player_Infos[playerid][pSpawned_Vehicle], Plate);
  1509. SetPlayerCheckpoint(playerid, Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z], 5.0);
  1510. return 1;
  1511. }else if(strcmp(Option, "park", true) == 0){
  1512. if(Player_Infos[playerid][pSpawned_Vehicle] == -1){
  1513. SendClientMessage(playerid, COLOR_RED, "You havent spawned any vehicle");
  1514. return 1;
  1515. }
  1516. if(!IsPlayerInAnyVehicle(playerid)){
  1517. SendClientMessage(playerid, COLOR_RED, "You are not in your vehicle.");
  1518. return 1;
  1519. }
  1520. if(Player_Vehicle_ID != Player_Infos[playerid][pSpawned_Vehicle]){
  1521. SendClientMessage(playerid, COLOR_RED, "This is not your vehicle.");
  1522. return 1;
  1523. }
  1524. if(IsPlayerInRangeOfPoint(playerid, 10, Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z])){
  1525. if(Player_Infos[playerid][pSpawned_Vehicle_Slot] == 1){
  1526. GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Panel_Status], Player_Infos[playerid][pVehicle_1_Doors_Status], Player_Infos[playerid][pVehicle_1_Lights_Status], Player_Infos[playerid][pVehicle_1_Tires_Status]);
  1527. GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Health]);
  1528. Player_Infos[playerid][pVehicle_1_Fuel] = VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]];
  1529. }else if(Player_Infos[playerid][pSpawned_Vehicle_Slot] == 2){
  1530. GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Panel_Status], Player_Infos[playerid][pVehicle_2_Doors_Status], Player_Infos[playerid][pVehicle_2_Lights_Status], Player_Infos[playerid][pVehicle_2_Tires_Status]);
  1531. GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Health]);
  1532. Player_Infos[playerid][pVehicle_2_Fuel] = VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]];
  1533. }else if(Player_Infos[playerid][pSpawned_Vehicle_Slot] == 3){
  1534. GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Panel_Status], Player_Infos[playerid][pVehicle_3_Doors_Status], Player_Infos[playerid][pVehicle_3_Lights_Status], Player_Infos[playerid][pVehicle_3_Tires_Status]);
  1535. GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Health]);
  1536. Player_Infos[playerid][pVehicle_3_Fuel] = VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]];
  1537. }
  1538. DestroyVehicle(Player_Infos[playerid][pSpawned_Vehicle]);
  1539. Player_Infos[playerid][pSpawned_Vehicle] = -1;
  1540. return 1;
  1541. }else{
  1542. SendClientMessage(playerid, COLOR_RED, "You are not near your parking, marker will show you parking position.");
  1543. SetPlayerCheckpoint(playerid, Player_Infos[playerid][pPark_X], Player_Infos[playerid][pPark_Y], Player_Infos[playerid][pPark_Z], 3.0);
  1544. return 1;
  1545. }
  1546. }else if(strcmp(Option, "lock", true) == 0){
  1547. new Lock_Unlock[16], Lock_String[128], Float:Veh_X, Float:Veh_Y, Float:Veh_Z;
  1548. new engine, lights, alarm, doors, bonnet, boot, objective;
  1549. GetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, doors, bonnet, boot, objective);
  1550. if(doors == 0){
  1551. format(Lock_Unlock, sizeof(Lock_Unlock), "locked");
  1552. }else {
  1553. format(Lock_Unlock, sizeof(Lock_Unlock), "unlocked");
  1554. }
  1555. if(IsPlayerInVehicle(playerid, Player_Infos[playerid][pSpawned_Vehicle])){
  1556. if(strcmp(Lock_Unlock, "locked", true) == 0){
  1557. SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 1, bonnet, boot, objective);
  1558. }else{
  1559. SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 0, bonnet, boot, objective);
  1560. }
  1561. format(Lock_String, sizeof(Lock_String), "***%s %s their vehicle.", Player_Infos[playerid][pName], Lock_Unlock);
  1562. }else{
  1563. GetVehiclePos(Player_Infos[playerid][pSpawned_Vehicle], Veh_X, Veh_Y, Veh_Z);
  1564. if(IsPlayerInRangeOfPoint(playerid, 5.0, Veh_X, Veh_Y, Veh_Z)){
  1565. if(strcmp(Lock_Unlock, "locked", true) == 0){
  1566. SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 1, bonnet, boot, objective);
  1567. }else{
  1568. SetVehicleParamsEx(Player_Infos[playerid][pSpawned_Vehicle], engine, lights, alarm, 0, bonnet, boot, objective);
  1569. }
  1570. format(Lock_String, sizeof(Lock_String), "***%s pressed button and %s their vehicle.", Player_Infos[playerid][pName], Lock_Unlock);
  1571. }else{
  1572. return 1;
  1573. }
  1574. }
  1575. SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 20.0, Lock_String);
  1576. return 1;
  1577. }else if(strcmp(Option, "save", true) == 0){
  1578. new Float:MPX, Float:MPY, Float:MPZ, Float:MFA;
  1579. if(Player_Infos[playerid][pSpawned_Vehicle] == -1){
  1580. SendClientMessage(playerid, COLOR_RED, "You didn't spawned your vehicle, /v get [SlotID]");
  1581. return 1;
  1582. }
  1583. if(IsPlayerInVehicle(playerid, Player_Infos[playerid][pSpawned_Vehicle])){
  1584. GetVehiclePos(Player_Infos[playerid][pSpawned_Vehicle], MPX, MPY, MPZ);
  1585. GetVehicleZAngle(Player_Infos[playerid][pSpawned_Vehicle], MFA);
  1586. Player_Infos[playerid][pPark_X] = MPX;
  1587. Player_Infos[playerid][pPark_Y] = MPY;
  1588. Player_Infos[playerid][pPark_Z] = MPZ;
  1589. Player_Infos[playerid][pPark_FA] = MFA;
  1590. SendClientMessage(playerid, COLOR_YELLOW, "Parking position saved.");
  1591. }
  1592. }else if(strcmp(Option, "buy", true) == 0){
  1593. new NearShop = -1;
  1594. if(Player_Infos[playerid][pVehicle_1_Key] != 999 && Player_Infos[playerid][pVehicle_2_Key] != 999 && Player_Infos[playerid][pVehicle_3_Key] != 999){
  1595. SendClientMessage(playerid, COLOR_BLUE, "All vehicle slots are used");
  1596. return 1;
  1597. }
  1598. for(new shop = 0; shop < MAX_VEHICLES_SHOPS; shop++){
  1599. if(IsPlayerInRangeOfPoint(playerid, 15.0, Vehicles_Shops[shop][vsX], Vehicles_Shops[shop][vsY], Vehicles_Shops[shop][vsZ])){
  1600. NearShop = shop;
  1601. break;
  1602. }
  1603. }
  1604. if(NearShop != -1){
  1605. new vtext[256], vi, Vehicle_Price, Vehicle;
  1606. new show = sizeof(buyablevehicles);
  1607. tmp = strtok(cmdtext, idx);
  1608. if(!strlen(tmp)){
  1609. new show2 = show / 3;
  1610. for(new v; v<show2; v++){
  1611. vi = v * 3;
  1612. format(vtext, sizeof(vtext), "ID: %d - Name: %s, Price: %d$ | ID: %d - Name: %s, Price: %d$ | ID: %d - Name: %s, Price: %d$", buyablevehicles[vi][bvModel], buyablevehicles[vi][bvName], buyablevehicles[vi][bvPrice], buyablevehicles[vi+1][bvModel], buyablevehicles[vi+1][bvName], buyablevehicles[vi+1][bvPrice], buyablevehicles[vi+2][bvModel], buyablevehicles[vi+2][bvName], buyablevehicles[vi+2][bvPrice]);
  1613. SendClientMessage(playerid, COLOR_YELLOW,vtext);
  1614. }
  1615. return 1;
  1616. }
  1617. Vehicle = strval(tmp);
  1618. new CanBuy = 0;
  1619. for(new vsi = 0; vsi < show; vsi++){
  1620. if(buyablevehicles[vsi][bvModel] == Vehicle){
  1621. Vehicle_Price = buyablevehicles[vsi][bvPrice];
  1622. CanBuy = 1;
  1623. }
  1624. }
  1625. if(CanBuy != 0){
  1626. if(Player_Infos[playerid][pCash] >= Vehicle_Price){
  1627. GivePlayerCash(playerid, -Vehicle_Price);
  1628. SendClientMessage(playerid, COLOR_BLUE, "Seller gave you keys from your new vehicle.");
  1629. if(Player_Infos[playerid][pVehicle_1_Key] == 999){
  1630. Player_Infos[playerid][pVehicle_1_Key] = strval(tmp);
  1631. Player_Infos[playerid][pVehicle_1_Fuel] = 50;
  1632. if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
  1633. SendClientMessage(playerid, COLOR_YELLOW, "You have one spawned vehicle, park that one, and /v get the one you just bought(vehicle will spawn on your parking location).");
  1634. return 1;
  1635. }
  1636. Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(strval(tmp), Vehicles_Shops[NearShop][vsvsx],Vehicles_Shops[NearShop][vsvsy], Vehicles_Shops[NearShop][vsvsz], Vehicles_Shops[NearShop][vsvsfa], 0, 0, 600);
  1637. return 1;
  1638. }else if(Player_Infos[playerid][pVehicle_2_Key] == 999){
  1639. Player_Infos[playerid][pVehicle_2_Key] = strval(tmp);
  1640. Player_Infos[playerid][pVehicle_2_Fuel] = 50;
  1641. if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
  1642. SendClientMessage(playerid, COLOR_YELLOW, "You have one spawned vehicle, park that one, and /v get the one you just bought(vehicle will spawn on your parking location).");
  1643. return 1;
  1644. }
  1645. Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(strval(tmp), Vehicles_Shops[NearShop][vsvsx],Vehicles_Shops[NearShop][vsvsy], Vehicles_Shops[NearShop][vsvsz], Vehicles_Shops[NearShop][vsvsfa], 0, 0, 600);
  1646. return 1;
  1647. }else if(Player_Infos[playerid][pVehicle_3_Key] == 999){
  1648. Player_Infos[playerid][pVehicle_3_Key] = strval(tmp);
  1649. Player_Infos[playerid][pVehicle_3_Fuel] = 50;
  1650. if(Player_Infos[playerid][pSpawned_Vehicle] != -1){
  1651. SendClientMessage(playerid, COLOR_YELLOW, "You have one spawned vehicle, park that one, and /v get the one you just bought(vehicle will spawn on your parking location).");
  1652. return 1;
  1653. }
  1654. Player_Infos[playerid][pSpawned_Vehicle] = CreateVehicle(strval(tmp), Vehicles_Shops[NearShop][vsvsx],Vehicles_Shops[NearShop][vsvsy], Vehicles_Shops[NearShop][vsvsz], Vehicles_Shops[NearShop][vsvsfa], 0, 0, 600);
  1655. VehicleFuel[Player_Infos[playerid][pSpawned_Vehicle]] = 50;
  1656. return 1;
  1657. }else{
  1658. SendClientMessage(playerid, COLOR_RED, "All vehicles slots are full");
  1659. }
  1660. }else{
  1661. SendClientMessage(playerid, COLOR_RED, "You can not afford this vehicle right now, get more money.");
  1662. return 1;
  1663. }
  1664. }else{
  1665. SendClientMessage(playerid, COLOR_BLUE, "We dont have vehicle you are looking for.");
  1666. return 1;
  1667. }
  1668. }else{
  1669. SendClientMessage(playerid, COLOR_RED, "You are not near dealership.");
  1670. return 1;
  1671. }
  1672. }else if(strcmp(Option, "paint", true) == 0){
  1673. if(IsPlayerInVehicle(playerid, Player_Infos[playerid][pSpawned_Vehicle])){
  1674. new Color_1, Color_2;
  1675. tmp = strtok(cmdtext, idx);
  1676. if(!strlen(tmp)){
  1677. SendClientMessage(playerid, COLOR_GREY, "USAGE: /v paint [color1] [color2]");
  1678. return 1;
  1679. }
  1680. Color_1 = strval(tmp);
  1681. tmp = strtok(cmdtext, idx);
  1682. if(!strlen(tmp)){
  1683. SendClientMessage(playerid, COLOR_GREY, "USAGE: /v paint [color1] [color2]");
  1684. return 1;
  1685. }
  1686. Color_2 = strval(tmp);
  1687. switch(Player_Infos[playerid][pSpawned_Vehicle_Slot]){
  1688. case 1:{
  1689. Player_Infos[playerid][pVehicle_1_Color_1] = Color_1;
  1690. Player_Infos[playerid][pVehicle_1_Color_2] = Color_2;
  1691. }
  1692. case 2:{
  1693. Player_Infos[playerid][pVehicle_2_Color_1] = Color_1;
  1694. Player_Infos[playerid][pVehicle_2_Color_2] = Color_2;
  1695. }
  1696. case 3:{
  1697. Player_Infos[playerid][pVehicle_3_Color_1] = Color_1;
  1698. Player_Infos[playerid][pVehicle_3_Color_2] = Color_2;
  1699. }
  1700. }
  1701. ChangeVehicleColor(Player_Infos[playerid][pSpawned_Vehicle], Color_1, Color_2);
  1702. }else{
  1703. SendClientMessage(playerid, COLOR_RED, "You must be in your vehicle.");
  1704. return 1;
  1705. }
  1706. }else if(strcmp(Option, "sell", true) == 0){
  1707. new stmp[128], sid, price, vehicle_sell_string[256];
  1708. if(Player_Infos[playerid][pSpawned_Vehicle] == -1){
  1709. SendClientMessage(playerid, COLOR_RED, "You have to /v get vehicle that you want to sell.");
  1710. return 1;
  1711. }
  1712. stmp = strtok(cmdtext, idx);
  1713. if(strlen(stmp) == 0){
  1714. SendClientMessage(playerid, COLOR_GREY, "USAGE: /v sell [id] [price]");
  1715. return 1;
  1716. }
  1717. sid = strval(stmp);
  1718. stmp = strtok(cmdtext, idx);
  1719. if(strlen(stmp) == 0){
  1720. SendClientMessage(playerid, COLOR_GREY, "USAGE: /v sell [id] [price]");
  1721. return 1;
  1722. }
  1723. price = strval(stmp);
  1724. if(!IsPlayerConnected(sid)){
  1725. SendClientMessage(playerid, COLOR_RED,"Inactive player.");
  1726. return 1;
  1727. }
  1728. if(playerid == sid){
  1729. SendClientMessage(playerid, COLOR_GREY, "You can not sell to your self.");
  1730. return 1;
  1731. }
  1732. if(IsPlayerNearPlayer(playerid, sid, 5.0)){
  1733. if(Player_Infos[sid][pVehicle_1_Key] != 999 && Player_Infos[sid][pVehicle_2_Key] != 999 && Player_Infos[sid][pVehicle_3_Key] != 999){
  1734. SendClientMessage(playerid, COLOR_BLUE, "Player has no free slot for vehicles.");
  1735. return 1;
  1736. }
  1737. OfferVehiclePlayer[sid] = playerid;
  1738. OfferVehiclePrice[sid] = price;
  1739. OfferVehicleModel[sid] = GetVehicleModel(Player_Infos[playerid][pSpawned_Vehicle]);
  1740. OfferedVehicle[sid] = 1;
  1741. new vehicle_sell[128], svModel[128];
  1742. for(new bavs = 0; bavs < sizeof(buyablevehicles); bavs++){
  1743. if(buyablevehicles[bavs][bvModel] == OfferVehicleModel[sid]){
  1744. format(svModel, sizeof(svModel), "%s", buyablevehicles[bavs][bvName]);
  1745. }
  1746. }
  1747. new Seller_Name[24];
  1748. GetPlayerName(playerid, Seller_Name, sizeof(Seller_Name));
  1749. format(vehicle_sell_string, sizeof(vehicle_sell_string), "Player %s offer you vehicle %s for %d$", Seller_Name, svModel, price);
  1750. SendClientMessage(sid, COLOR_YELLOW, vehicle_sell);
  1751. return 1;
  1752. }
  1753. }else if(strcmp(Option, "accept", true) == 0){
  1754. new string[128], buyer_name[24];
  1755. if(OfferedVehicle[playerid] == 1){
  1756. if(GetPlayerMoney(playerid) >= OfferVehiclePrice[playerid]){
  1757. if(IsPlayerNearPlayer(playerid, OfferVehiclePlayer[playerid], 10.0)){
  1758. GetPlayerName(playerid, buyer_name, sizeof(buyer_name));
  1759. format(string, sizeof(string), "%s has bought a vehicle from you for $%d.", buyer_name, OfferVehiclePrice[playerid]);
  1760. SendClientMessage(OfferVehiclePlayer[playerid], COLOR_WHITE, string);
  1761. GetPlayerName(OfferVehiclePlayer[playerid], buyer_name, sizeof(buyer_name));
  1762. format(string, sizeof(string), "You have bought a vehicle from %s for $%d.", buyer_name, OfferVehiclePrice[playerid]);
  1763. SendClientMessage(playerid, COLOR_WHITE, string);
  1764. if(Player_Infos[playerid][pVehicle_1_Key] == 999){
  1765. Player_Infos[playerid][pVehicle_1_Key] = OfferVehicleModel[playerid];
  1766. }else if(Player_Infos[playerid][pVehicle_2_Key] == 999){
  1767. Player_Infos[playerid][pVehicle_2_Key] = OfferVehicleModel[playerid];
  1768. }else if(Player_Infos[playerid][pVehicle_3_Key] == 999){
  1769. Player_Infos[playerid][pVehicle_3_Key] = OfferVehicleModel[playerid];
  1770. }
  1771. if(Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle_Slot] == 1){
  1772. Player_Infos[OfferVehiclePlayer[playerid]][pVehicle_1_Key] = 999;
  1773. }else if(Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle_Slot] == 2){
  1774. Player_Infos[OfferVehiclePlayer[playerid]][pVehicle_2_Key] = 999;
  1775. }else if(Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle_Slot] == 3){
  1776. Player_Infos[OfferVehiclePlayer[playerid]][pVehicle_3_Key] = 999;
  1777. }
  1778. DestroyVehicle(Player_Infos[playerid][pSpawned_Vehicle]);
  1779. Player_Infos[playerid][pSpawned_Vehicle] = Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle];
  1780. Player_Infos[OfferVehiclePlayer[playerid]][pSpawned_Vehicle] = -1;
  1781. GivePlayerCash(OfferVehiclePlayer[playerid], OfferVehiclePrice[playerid]);
  1782. GivePlayerCash(playerid, -OfferVehiclePrice[playerid]);
  1783. new NameP[64];
  1784. GetPlayerName(playerid, NameP, sizeof(NameP));
  1785. SaveAccount(NameP, 0);
  1786. GetPlayerName(OfferVehiclePlayer[playerid], NameP, sizeof(NameP));
  1787. SaveAccount(NameP, 0);
  1788. return 1;
  1789. }else{
  1790. SendClientMessage(playerid, COLOR_RED, "You are not near player.");
  1791. return 1;
  1792. }
  1793. }else{
  1794. SendClientMessage(playerid, COLOR_RED, "You dont have enough cash.");
  1795. return 1;
  1796. }
  1797. }else{
  1798. SendClientMessage(playerid, COLOR_RED, "There is no vehicle offer.");
  1799. return 1;
  1800. }
  1801. }
  1802. }else if(strcmp(cmd, "/pay", true) == 0){
  1803. new PayID, Amount;
  1804. tmp = strtok(cmdtext, idx);
  1805. if(!strlen(tmp)){
  1806. SendClientMessage(playerid, COLOR_GREY, "USAGE: /pay [PlayerID] [Amount]");
  1807. return 1;
  1808. }
  1809. PayID = strval(tmp);
  1810. tmp = strtok(cmdtext, idx);
  1811. if(!strlen(tmp)){
  1812. SendClientMessage(playerid, COLOR_GREY, "USAGE: /pay [PlayerID] [Amount]");
  1813. return 1;
  1814. }
  1815. Amount = strval(tmp);
  1816. Amount = abs(Amount);
  1817. new Pay_String[128];
  1818. if(!IsPlayerConnected(PayID) || PayID == playerid){
  1819. SendClientMessage(playerid, COLOR_GREY, "Wrong id.");
  1820. return 1;
  1821. }
  1822. if(IsPlayerNearPlayer(playerid, PayID, 3.0)){
  1823. if(GetPlayerCash(playerid) >= Amount){
  1824. GivePlayerCash(playerid, -Amount);
  1825. GivePlayerCash(PayID, Amount);
  1826. format(Pay_String, sizeof(Pay_String), "You gave %d$ to %s.", Amount, Player_Infos[PayID][pName]);
  1827. SendClientMessage(playerid, COLOR_BLUE, Pay_String);
  1828. format(Pay_String, sizeof(Pay_String), "%s gave you %d$.", Player_Infos[playerid][pName], Amount);
  1829. SendClientMessage(playerid, COLOR_BLUE, Pay_String);
  1830. return 1;
  1831. }else{
  1832. SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
  1833. return 1;
  1834. }
  1835. }
  1836. }else if(strcmp(cmd, "/o", true) == 0){
  1837. new OOC_String[256];
  1838. tmp = strrest(cmdtext, idx);
  1839. if(OOC_Enabled == true){
  1840. if(!strlen(tmp)){
  1841. return 1;
  1842. }
  1843. format(OOC_String, sizeof(OOC_String), "%s: %s", Player_Infos[playerid][pName], tmp);
  1844. SendClientMessageToAll(COLOR_GREY, OOC_String);
  1845. }else{
  1846. SendClientMessage(playerid, COLOR_RED, "OOC Channel disabled by admin");
  1847. return 1;
  1848. }
  1849. }else if(strcmp(cmd, "/me", true) == 0){
  1850. new Me_String[256];
  1851. tmp = strrest(cmdtext, idx);
  1852. if(!strlen(tmp)){
  1853. SendClientMessage(playerid, COLOR_GREY, "USAGE: /me [Text]");
  1854. return 1;
  1855. }
  1856. format(Me_String, sizeof(Me_String), "%s %s", Player_Infos[playerid][pName], tmp);
  1857. SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 10.0, Me_String);
  1858. return 1;
  1859. }else if(strcmp(cmd, "/w", true) == 0){
  1860. new W_ID, W_String[256];
  1861. tmp = strtok(cmdtext, idx);
  1862. if(!strlen(tmp)){
  1863. SendClientMessage(playerid, COLOR_GREY, "USAGE: /w [PlayerID] [Text]");
  1864. return 1;
  1865. }
  1866. W_ID = strval(tmp);
  1867. tmp = strrest(cmdtext, idx);
  1868. if(!strlen(tmp)){
  1869. SendClientMessage(playerid, COLOR_GREY, "USAGE: /w [PlayerID] [Text]");
  1870. return 1;
  1871. }
  1872. if(IsPlayerNearPlayer(playerid, W_ID, 2.0) && IsPlayerConnected(W_ID) && W_ID != playerid){
  1873. format(W_String, sizeof(W_String), "You to %s: %s", Player_Infos[W_ID][pName], tmp);
  1874. SendClientMessage(playerid, COLOR_YELLOW, W_String);
  1875. format(W_String, sizeof(W_String), "%s wgisper's to You: %s", Player_Infos[playerid][pName], tmp);
  1876. SendClientMessage(W_ID, COLOR_YELLOW, W_String);
  1877. format(W_String, sizeof(W_String), "%s whisper's something to %s", Player_Infos[playerid][pName], Player_Infos[W_ID][pName]);
  1878. SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 10.0, W_String);
  1879. }else{
  1880. SendClientMessage(playerid, COLOR_RED, "You must be near that player");
  1881. return 1;
  1882. }
  1883. }else if(strcmp(cmd, "/s", true) == 0){
  1884. new Shout_String[256];
  1885. tmp = strrest(cmdtext, idx);
  1886. if(!strlen(tmp)){
  1887. SendClientMessage(playerid, COLOR_GREY, "USAGE: /s [Text]");
  1888. return 1;
  1889. }
  1890. format(Shout_String, sizeof(Shout_String), "%s shouts: %s", Player_Infos[playerid][pName], tmp);
  1891. SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 20.0, Shout_String);
  1892. return 1;
  1893. }else if(strcmp(cmd, "/b", true) == 0){
  1894. new Local_OOC_String[256];
  1895. tmp = strrest(cmdtext, idx);
  1896. if(!strlen(tmp)){
  1897. SendClientMessage(playerid, COLOR_GREY, "USAGE: /b [Text]");
  1898. return 1;
  1899. }
  1900. format(Local_OOC_String, sizeof(Local_OOC_String), "((%s: %s))", Player_Infos[playerid][pName], tmp);
  1901. SendToNearPlayers(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, 10.0, Local_OOC_String);
  1902. return 1;
  1903. }else if(strcmp(cmd, "/f", true) == 0){
  1904. new Faction_Chat[256];
  1905. if(Player_Infos[playerid][pFaction] == 255){
  1906. SendClientMessage(playerid, COLOR_RED, "You are not in faction.");
  1907. return 1;
  1908. }
  1909. tmp = strrest(cmdtext, idx);
  1910. if(!strlen(tmp)){
  1911. SendClientMessage(playerid, COLOR_GREY, "USAGE: /f [Text]");
  1912. return 1;
  1913. }
  1914. format(Faction_Chat, sizeof(Faction_Chat), "(Faction)%s: %s", Player_Infos[playerid][pName], tmp);
  1915. for(new i=0;i<MAX_PLAYERS;i++){
  1916. if(IsPlayerConnected(i) && Player_Infos[i][pFaction] == Player_Infos[playerid][pFaction]){
  1917. SendClientMessage(i, COLOR_FADE3, Faction_Chat);
  1918. }
  1919. }
  1920. return 1;
  1921. }else if(strcmp(cmd, "/do", true) == 0){
  1922. new Do_String[128];
  1923. tmp = strrest(cmdtext, idx);
  1924. if(!strlen(tmp)){
  1925. SendClientMessage(playerid, COLOR_GREY, "USAGE: /do [Action]");
  1926. return 1;
  1927. }
  1928. format(Do_String, sizeof(Do_String), "%s ((%s))", Player_Infos[playerid][pName], tmp);
  1929. SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, 10.0, Do_String);
  1930. return 1;
  1931. }else if(strcmp(cmd, "/togphone", true) == 0){
  1932. new Tog_Phone_String[128];
  1933. new Color;
  1934. if(Player_Infos[playerid][pMobile_Num] != 0){
  1935. Player_Infos[playerid][pMobile_Tog] = abs(Player_Infos[playerid][pMobile_Tog] - 1);
  1936. if(Player_Infos[playerid][pMobile_Tog] == 0){
  1937. Color = COLOR_GREEN;
  1938. format(Tog_Phone_String, sizeof(Tog_Phone_String), "You phone is now off.");
  1939. }else{
  1940. Color = COLOR_RED;
  1941. format(Tog_Phone_String, sizeof(Tog_Phone_String), "You phone is now on");
  1942. }
  1943. SendClientMessage(playerid, Color, Tog_Phone_String);
  1944. return 1;
  1945. }else{
  1946. SendClientMessage(playerid, COLOR_RED, "You don't have cellphone.");
  1947. return 1;
  1948. }
  1949. }else if(strcmp(cmd, "/balance", true) == 0){
  1950. if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
  1951. BankSystem("balance", -1, playerid, -1);
  1952. return 1;
  1953. }else{
  1954. SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
  1955. return 1;
  1956. }
  1957. }else if(strcmp(cmd, "/addbank", true) == 0){
  1958. if(IsPlayerAdministrator(playerid, 1338)){
  1959. new Float:IntX, Float:IntY, Float:IntZ, Int;
  1960. tmp = strtok(cmdtext,idx);
  1961. if(!strlen(tmp)){
  1962. AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
  1963. SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");\
  1964. LoadBanks();
  1965. return 1;
  1966. }
  1967. IntX = floatstr(tmp);
  1968. tmp = strtok(cmdtext,idx);
  1969. if(!strlen(tmp)){
  1970. AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
  1971. SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
  1972. LoadBanks();
  1973. return 1;
  1974. }
  1975. IntY = floatstr(tmp);
  1976. tmp = strtok(cmdtext,idx);
  1977. if(!strlen(tmp)){
  1978. AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
  1979. SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
  1980. LoadBanks();
  1981. return 1;
  1982. }
  1983. IntZ = floatstr(tmp);
  1984. tmp = strtok(cmdtext,idx);
  1985. if(!strlen(tmp)){
  1986. AddBank(2315.952880, -1.618174, 26.742187, 0, playerid);
  1987. SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
  1988. LoadBanks();
  1989. return 1;
  1990. }
  1991. Int = strval(tmp);
  1992. AddBank(IntX, IntY, IntZ, Int, playerid);
  1993. SendClientMessage(playerid, COLOR_GREEN, "Bank has been created.");
  1994. LoadBanks();
  1995. return 1;
  1996. }
  1997. return 1;
  1998. }else if(strcmp(cmd, "/loadbanks", true) == 0){
  1999. if(IsPlayerAdministrator(playerid, 1338)){
  2000. LoadBanks();
  2001. return 1;
  2002. }
  2003. return 1;
  2004. }else if(strcmp(cmd, "/deposit", true) == 0){
  2005. new Money;
  2006. if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
  2007. tmp = strtok(cmdtext, idx);
  2008. if(!strlen(tmp)){
  2009. SendClientMessage(playerid, COLOR_GREY, "USAGE: /deposid [Amount]");
  2010. return 1;
  2011. }
  2012. Money = BankSystem("deposit", strval(tmp), playerid, -1);
  2013. if(!Money){
  2014. SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
  2015. return 1;
  2016. }
  2017. return 1;
  2018. }else{
  2019. SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
  2020. return 1;
  2021. }
  2022. }else if(strcmp(cmd, "/withdraw", true) == 0){
  2023. new Money;
  2024. if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
  2025. tmp = strtok(cmdtext, idx);
  2026. if(!strlen(tmp)){
  2027. SendClientMessage(playerid, COLOR_GREY, "USAGE: /withdraw [Amount]");
  2028. return 1;
  2029. }
  2030. Money = BankSystem("withdraw", strval(tmp), playerid, -1);
  2031. if(!Money){
  2032. SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
  2033. return 1;
  2034. }
  2035. return 1;
  2036. }else{
  2037. SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
  2038. return 1;
  2039. }
  2040. }else if(strcmp(cmd, "/transfer", true) == 0){
  2041. new Transfer_String[256], Money, GiveID;
  2042. if(Player_Infos[playerid][pInObject] != -1 && Player_Infos[playerid][pObjectType] == 5 || IsPlayerNearATM(playerid)){
  2043. tmp = strtok(cmdtext, idx);
  2044. if(!strlen(tmp)){
  2045. SendClientMessage(playerid, COLOR_GREY, "USAGE: /transfer [PlayerID] [Amount]");
  2046. return 1;
  2047. }
  2048. GiveID = strval(tmp);
  2049. tmp = strtok(cmdtext, idx);
  2050. if(!strlen(tmp)){
  2051. SendClientMessage(playerid, COLOR_GREY, "USAGE: /transfer [PlayerID] [Amount]");
  2052. return 1;
  2053. }
  2054. Money = strval(tmp);
  2055. if(!IsPlayerConnected(GiveID)){
  2056. SendClientMessage(playerid, COLOR_GREY, "Inactive id.");
  2057. return 1;
  2058. }
  2059. if(Player_Infos[playerid][pBank] < Money){
  2060. SendClientMessage(playerid, COLOR_RED, "You don't have that much money.");
  2061. return 1;
  2062. }
  2063. BankSystem("transfer", Money, playerid, GiveID);
  2064. format(Transfer_String, sizeof(Transfer_String), "You trasfered %d$ to %s bank account.", Money, Player_Infos[GiveID][pName]);
  2065. SendClientMessage(playerid, COLOR_BLUE, Transfer_String);
  2066. format(Transfer_String, sizeof(Transfer_String), "%s trasfered %d$ to your bank account.", Player_Infos[playerid][pName], Money);
  2067. SendClientMessage(playerid, COLOR_BLUE, Transfer_String);
  2068. return 1;
  2069. }else{
  2070. SendClientMessage(playerid, COLOR_RED, "You are not in bank or near atm.");
  2071. return 1;
  2072. }
  2073. }else if(strcmp(cmd, "/house", true) == 0){
  2074. new Option[24];
  2075. tmp = strtok(cmdtext, idx);
  2076. if(!strlen(tmp)){
  2077. SendClientMessage(playerid, COLOR_GREY, "USAGE: /house [key/lock,buy,sell,store]");
  2078. return 1;
  2079. }
  2080. format(Option, sizeof(Option), "%s", tmp);
  2081. if(strcmp(Option, "key", true) == 0){
  2082. new key_string[64];
  2083. format(key_string, sizeof(key_string), "House key: %d", Player_Infos[playerid][pHouse_Key]);
  2084. SendClientMessage(playerid, COLOR_WHITE, key_string);
  2085. return 1;
  2086. }
  2087. if(strcmp(Option, "lock", true) == 0){
  2088. if(Player_Infos[playerid][pHouse_Key] == 999){
  2089. SendClientMessage(playerid, COLOR_RED, "You dont have a house.");
  2090. return 1;
  2091. }
  2092. for(new i = 0; i < MAX_HOUSES; i++){
  2093. if(strcmp(HouseInfos[i][OwnerName], Player_Infos[playerid][pName], true) == 0){
  2094. if(IsPlayerInRangeOfPoint(playerid, 5, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
  2095. if(HouseInfos[i][Locked] == 1){
  2096. HouseInfos[i][Locked] = 0;
  2097. GameTextForPlayer(playerid, "~g~Unlocked", 2000, 5);
  2098. return 1;
  2099. }else{
  2100. HouseInfos[i][Locked] = 1;
  2101. GameTextForPlayer(playerid, "~r~Locked", 2000, 5);
  2102. return 1;
  2103. }
  2104. }else{
  2105. SendClientMessage(playerid, COLOR_RED, "You are not near your house.");
  2106. return 1;
  2107. }
  2108. }
  2109. }
  2110. }else if(strcmp(Option, "buy", true) == 0){
  2111. new hbstring[128];
  2112. if(Player_Infos[playerid][pHouse_Key] != 999){
  2113. SendClientMessage(playerid, COLOR_RED, "You already own the house.");
  2114. return 1;
  2115. }
  2116. for(new i = 0; i < MAX_HOUSES; i++){
  2117. if(IsPlayerInRangeOfPoint(playerid, 5, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
  2118. if(HouseInfos[i][OnSale] != 1){
  2119. SendClientMessage(playerid, COLOR_RED, "This house is not on sale.");
  2120. return 1;
  2121. }
  2122. if(GetPlayerCash(playerid) >= HouseInfos[i][Price]){
  2123. Player_Infos[playerid][pHouse_Key] = i;
  2124. HouseInfos[i][OnSale] = 0;
  2125. format(HouseInfos[i][OwnerName], 24, "%s", Player_Infos[playerid][pName]);
  2126. Delete3DTextLabel(HouseInfos[i][hTextLabelID]);
  2127. format(hbstring, sizeof(hbstring), "%s, Owner: %s", HouseInfos[i][HouseName], Player_Infos[playerid][pName]);
  2128. HouseInfos[i][hTextLabelID] = Create3DTextLabel(hbstring, 0x0000BBAA, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ], 20, 0, 0);
  2129. GameTextForPlayer(playerid, "~g~You bought the house", 3000, 5);
  2130. GivePlayerCash(playerid, -HouseInfos[i][Price]);
  2131. ReloadHousesFile();
  2132. return 1;
  2133. }
  2134. }
  2135. }
  2136. }else if(strcmp(Option, "sell", true) == 0){
  2137. new ID, SellPrice, hSell_String[128];
  2138. if(Player_Infos[playerid][pHouse_Key] == 999){
  2139. SendClientMessage(playerid, COLOR_RED, "You dont have a house");
  2140. return 1;
  2141. }
  2142. tmp = strtok(cmdtext, idx);
  2143. if(!strlen(tmp)){
  2144. SendClientMessage(playerid, COLOR_GREY, "USAGE: /house sell [playerid] [price]");
  2145. return 1;
  2146. }
  2147. ID = strval(tmp);
  2148. tmp = strtok(cmdtext, idx);
  2149. if(!strlen(tmp)){
  2150. SendClientMessage(playerid, COLOR_GREY, "USAGE: /house sell [playerid] [price]");
  2151. return 1;
  2152. }
  2153. SellPrice = strval(tmp);
  2154. if(!IsPlayerConnected(ID)){
  2155. SendClientMessage(playerid, COLOR_RED, "Inactive player");
  2156. return 1;
  2157. }
  2158. if(!IsPlayerNearPlayer(playerid, ID, 5.0)){
  2159. SendClientMessage(playerid, COLOR_RED, "Player must be near");
  2160. return 1;
  2161. }
  2162. if(Player_Infos[ID][pHouse_Key] != 999){
  2163. SendClientMessage(playerid, COLOR_RED, "Player already own the house");
  2164. return 1;
  2165. }
  2166. format(hSell_String, sizeof(hSell_String), "%s want to sell you house for %d$, /house accept", Player_Infos[playerid][pName], SellPrice);
  2167. SendClientMessage(ID, COLOR_WHITE, hSell_String);
  2168. OfferedHouse[ID] = Player_Infos[playerid][pHouse_Key];
  2169. OfferedHousePrice[ID] = SellPrice;
  2170. OfferedHousePlayer[ID] = playerid;
  2171. return 1;
  2172. }else if(strcmp(Option, "accept", true) == 0){
  2173. new Accept_String[128], hbstring[128];
  2174. if(OfferedHouse[playerid] == -1){
  2175. return 1;
  2176. }
  2177. if(GetPlayerCash(playerid) < OfferedHousePrice[playerid]){
  2178. SendClientMessage(playerid, COLOR_RED, "You dont have enought money");
  2179. return 1;
  2180. }
  2181. format(Accept_String, sizeof(Accept_String), "%s bought house from you for %d$", Player_Infos[playerid][pName], OfferedHousePrice[playerid]);
  2182. SendClientMessage(OfferedHousePlayer[playerid], COLOR_WHITE, Accept_String);
  2183. format(Accept_String, sizeof(Accept_String), "You bought house from %s for %d$", Player_Infos[OfferedHousePlayer[playerid]], OfferedHousePrice[playerid]);
  2184. SendClientMessage(playerid, COLOR_WHITE, Accept_String);
  2185. GivePlayerCash(playerid, -OfferedHousePrice[playerid]);
  2186. GivePlayerCash(OfferedHousePlayer[playerid], OfferedHousePrice[playerid]);
  2187. Player_Infos[playerid][pHouse_Key] = OfferedHouse[playerid];
  2188. Player_Infos[OfferedHousePlayer[playerid]][pHouse_Key] = 999;
  2189. Delete3DTextLabel(HouseInfos[Player_Infos[playerid][pHouse_Key]][hTextLabelID]);
  2190. format(hbstring, sizeof(hbstring), "%s, Owner: %s", HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseName], Player_Infos[playerid][pName]);
  2191. HouseInfos[Player_Infos[playerid][pHouse_Key]][hTextLabelID] = Create3DTextLabel(hbstring, 0x0000BBAA, HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseEnterX], HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseEnterY], HouseInfos[Player_Infos[playerid][pHouse_Key]][HouseEnterZ], 20, 0, 0);
  2192. ReloadHousesFile();
  2193. return 1;
  2194. }
  2195. }else if(strcmp(cmd, "/business", true) == 0){
  2196. new Option[10];
  2197. new bizID = Player_Infos[playerid][pBiz_Key];
  2198. tmp = strtok(cmdtext, idx);
  2199. if(!strlen(tmp)){
  2200. SendClientMessage(playerid, COLOR_GREY, "USAGE: /business [buy/sell/fee/lock]");
  2201. return 1;
  2202. }
  2203. format(Option, sizeof(Option), "%s", tmp);
  2204. if(strcmp(Option, "buy", true) == 0){
  2205. if(bizID != 999){
  2206. SendClientMessage(playerid, COLOR_RED, "You already own a business.");
  2207. return 1;
  2208. }
  2209. for(new i = 0; i < MAX_BUSINESS; i++){
  2210. if(IsPlayerInRangeOfPoint(playerid, 5, Business_Infos[i][bizEntrance_X], Business_Infos[i][bizEntrance_Y], Business_Infos[i][bizEntrance_Z])){
  2211. if(Business_Infos[i][bizOn_Sale] == 0){
  2212. SendClientMessage(playerid, COLOR_RED, "This business is not for sale.");
  2213. return 1;
  2214. }
  2215. if(GetPlayerCash(playerid) < Business_Infos[i][bizPrice]){
  2216. SendClientMessage(playerid, COLOR_RED, "You dont have enought money.");
  2217. return 1;
  2218. }
  2219. format(Business_Infos[i][bizOwner_Name], 24, "%s", Player_Infos[playerid][pName]);
  2220. Business_Infos[i][bizOn_Sale] = 0;
  2221. Player_Infos[playerid][pBiz_Key] = i;
  2222. GivePlayerCash(playerid, -Business_Infos[i][bizPrice]);
  2223. GameTextForPlayer(playerid, "~g~You bought a business", 2000, 5);
  2224. ReloadBusinessFile();
  2225. }
  2226. }
  2227. }else if(strcmp(Option, "key", true) == 0){
  2228. new KeyS[64];
  2229. format(KeyS, sizeof(KeyS), "Biz key %d", bizID);
  2230. SendClientMessage(playerid, COLOR_WHITE, KeyS);
  2231. return 1;
  2232. }else if(strcmp(Option, "lock", true) == 0){
  2233. if(bizID == 999){
  2234. SendClientMessage(playerid, COLOR_RED, "You doesn't own any business");
  2235. return 1;
  2236. }
  2237. if(IsPlayerInRangeOfPoint(playerid, 5, Business_Infos[bizID][bizEntrance_X], Business_Infos[bizID][bizEntrance_Y], Business_Infos[bizID][bizEntrance_Z])){
  2238. if(Business_Infos[bizID][bizLocked] == 0){
  2239. Business_Infos[bizID][bizLocked] = 1;
  2240. GameTextForPlayer(playerid, "~b~Business ~r~locked", 2000, 5);
  2241. return 1;
  2242. }else{
  2243. Business_Infos[bizID][bizLocked] = 0;
  2244. GameTextForPlayer(playerid, "~b~Business ~g~unlocked", 2000, 5);
  2245. return 1;
  2246. }
  2247. }else{
  2248. SendClientMessage(playerid, COLOR_RED, "You are not near your business.");
  2249. return 1;
  2250. }
  2251. }else if(strcmp(Option, "sell", true) == 0){
  2252. new bSell_Price, bSell_Buyer, bSell_String[128];
  2253. if(bizID == 999){
  2254. SendClientMessage(playerid, COLOR_RED, "You doesn't own any business");
  2255. return 1;
  2256. }
  2257. tmp = strtok(cmdtext, idx);
  2258. if(!strlen(tmp)){
  2259. SendClientMessage(playerid, COLOR_GREY, "USAGE: /business sell [playerid] [price]");
  2260. return 1;
  2261. }
  2262. bSell_Buyer = strval(tmp);
  2263. tmp = strtok(cmdtext, idx);
  2264. if(!strlen(tmp)){
  2265. SendClientMessage(playerid, COLOR_GREY, "USAGE: /business sell [playerid] [price]");
  2266. return 1;
  2267. }
  2268. bSell_Price = strval(tmp);
  2269. if(!IsPlayerNearPlayer(playerid, bSell_Buyer, 3.0)){
  2270. SendClientMessage(playerid, COLOR_RED, "Player must be near you.");
  2271. return 1;
  2272. }
  2273. if(!IsPlayerConnected(bSell_Buyer)){
  2274. SendClientMessage(playerid, COLOR_RED, "Inactive player");
  2275. return 1;
  2276. }
  2277. if(Player_Infos[bSell_Buyer][pBiz_Key] != 999){
  2278. SendClientMessage(playerid, COLOR_RED, "Player already have business.");
  2279. return 1;
  2280. }
  2281. OfferedBusiness[bSell_Buyer] = bizID;
  2282. OfferedBusinessPlayer[bSell_Buyer] = playerid;
  2283. OfferedBusinessPrice[bSell_Buyer] = bSell_Price;
  2284. format(bSell_String, sizeof(bSell_String), "%s want to sell you business for %d$, type /business accept to buy it", Player_Infos[playerid][pName], bSell_Price);
  2285. SendClientMessage(bSell_Buyer, COLOR_WHITE, bSell_String);
  2286. return 1;
  2287. }else if(strcmp(Option, "accept", true) == 0){
  2288. if(OfferedBusiness[playerid] == -1){
  2289. return 1;
  2290. }
  2291. if(GetPlayerCash(playerid) < OfferedBusinessPrice[playerid]){
  2292. SendClientMessage(playerid, COLOR_RED, "You don't have enough money.");
  2293. OfferedBusiness[playerid] = -1;
  2294. OfferedBusinessPrice[playerid] = 0;
  2295. OfferedBusinessPlayer[playerid] = -1;
  2296. return 1;
  2297. }
  2298. GivePlayerCash(playerid, -OfferedBusinessPrice[playerid]);
  2299. Player_Infos[playerid][pBiz_Key] = OfferedBusiness[playerid];
  2300. Player_Infos[OfferedBusinessPlayer[playerid]][pBiz_Key] = -1;
  2301. GameTextForPlayer(playerid, "~g~You bought new business", 2000, 5);
  2302. GameTextForPlayer(OfferedBusinessPlayer[playerid], "~r~You sold your business", 2000, 5);
  2303. OfferedBusiness[playerid] = -1;
  2304. OfferedBusinessPrice[playerid] = 0;
  2305. OfferedBusinessPlayer[playerid] = -1;
  2306. return 1;
  2307. }
  2308. }else if(strcmp(cmd, "/addvehicleshop", true) == 0){
  2309. if(IsPlayerAdministrator(playerid, 1338)){
  2310. tmp = strrest(cmdtext, idx);
  2311. if(strlen(tmp) < 5){
  2312. SendClientMessage(playerid, COLOR_RED, "Shop name must have at least 5 characters");
  2313. return 1;
  2314. }
  2315. AddVehicleShop(playerid, tmp);
  2316. return 1;
  2317. }
  2318. }else if(strcmp(cmd, "/loadvehicleshop", true) == 0){
  2319. if(IsPlayerAdministrator(playerid, 1338)){
  2320. LoadVehicleShops();
  2321. return 1;
  2322. }
  2323. }else if(strcmp(cmd, "/vehicleshops", true) == 0){
  2324. new VSS[128];
  2325. if(IsPlayerAdministrator(playerid, 1338)){
  2326. for(new i = 0; i<sizeof(Vehicles_Shops);i++){
  2327. if(strlen(Vehicles_Shops[i][vsName])){
  2328. format(VSS, sizeof(VSS), "%d: %s, %f, %f, %f, %f", i, Vehicles_Shops[i][vsName], Vehicles_Shops[i][vsvsx], Vehicles_Shops[i][vsvsy], Vehicles_Shops[i][vsvsz], Vehicles_Shops[i][vsvsfa]);
  2329. SendClientMessage(playerid, COLOR_YELLOW, VSS);
  2330. }
  2331. }
  2332. return 1;
  2333. }
  2334. }else if(strcmp(cmd, "/setvehiclespawn", true) == 0){
  2335. tmp = strtok(cmdtext, idx);
  2336. if(IsPlayerAdministrator(playerid, 1338)){
  2337. if(!strlen(tmp)){
  2338. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setvehiclespawn [Vehicle ShopID]");
  2339. return 1;
  2340. }
  2341. return SetVehicleSpawn(strval(tmp), playerid);
  2342. }
  2343. }else if(strcmp(cmd, "/loadvehiclespawns", true) == 0){
  2344. if(IsPlayerAdministrator(playerid, 1338)){
  2345. return LoadVehicleSpawns();
  2346. }
  2347. }else if(strcmp(cmd, "/add247store", true) == 0){
  2348. if(IsPlayerAdministrator(playerid, 1338)){
  2349. tmp = strtok(cmdtext, idx);
  2350. if(!strlen(tmp)){
  2351. SendClientMessage(playerid, COLOR_GREY, "USAGE /add247store [Type (1,2,3,4,5,6)]");
  2352. return 1;
  2353. }
  2354. if(strval(tmp) > 6 && strval(tmp) < 1){
  2355. SendClientMessage(playerid, COLOR_GREY, "USAGE /add247store [Type (1,2,3,4,5,6)]");
  2356. return 1;
  2357. }
  2358. Add247(playerid, strval(tmp));
  2359. return 1;
  2360. }
  2361. }else if(strcmp(cmd, "/load247", true) == 0){
  2362. if(IsPlayerAdministrator(playerid, 1338)){
  2363. Load247();
  2364. return 1;
  2365. }
  2366. }else if(strcmp(cmd, "/houses", true) == 0){
  2367. if(Player_Infos[playerid][pAdministrator] >= 1){
  2368. new send[128];
  2369. for(new i = 0; i < MAX_HOUSES; i++){
  2370. if(strlen(HouseInfos[i][OwnerName]) >= 5){
  2371. format(send, sizeof(send), "%s, %s, %d, %d", HouseInfos[i][OwnerName], HouseInfos[i][HouseName], HouseInfos[i][OnSale], i);
  2372. SendClientMessage(playerid, COLOR_YELLOW, send);
  2373. }
  2374. }
  2375. }
  2376. }else if(strcmp(cmd, "/addatm", true) == 0){
  2377. if(Player_Infos[playerid][pAdministrator] != 1338){
  2378. return 1;
  2379. }else{
  2380. AddAtm(playerid);
  2381. SendClientMessage(playerid, COLOR_YELLOW, "You added ATM at your current possition");
  2382. }
  2383. }else if(strcmp(cmd, "/loadatms", true) == 0){
  2384. if(IsPlayerAdministrator(playerid, 1338)){
  2385. LoadAtms();
  2386. SendClientMessage(playerid, COLOR_GREEN, "ATMS Loaded...");
  2387. return 1;
  2388. }
  2389. }else if(strcmp(cmd, "/addspeedcam", true) == 0){
  2390. if(IsPlayerAdministrator(playerid, 1338)){
  2391. tmp = strtok(cmdtext, idx);
  2392. if(!strlen(tmp)){
  2393. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addspeedcam [Max Speed]");
  2394. return 1;
  2395. }
  2396. if(strval(tmp) < 20){
  2397. SendClientMessage(playerid, COLOR_RED, "Max speed must be at least 20");
  2398. return 1;
  2399. }
  2400. AddSpeedCam(playerid, strval(tmp));
  2401. SendClientMessage(playerid, COLOR_GREEN, "You added speedcam on your position...");
  2402. return 1;
  2403. }
  2404. }else if(strcmp(cmd, "/loadspeedcams", true) == 0){
  2405. if(IsPlayerAdministrator(playerid, 1338)){
  2406. LoadSpeedCams();
  2407. return 1;
  2408. }
  2409. }else if(strcmp(cmd, "/addgasstation", true) == 0){
  2410. if(IsPlayerAdministrator(playerid, 1338)){
  2411. new rate;
  2412. tmp = strtok(cmdtext, idx);
  2413. if(!strlen(tmp)){
  2414. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addgasstaion [Rate] [Name]");
  2415. return 1;
  2416. }
  2417. rate = strval(tmp);
  2418. if(rate < 1) rate = 1;
  2419. tmp = strrest(cmdtext, idx);
  2420. if(!strlen(tmp)){
  2421. SendClientMessage(playerid, COLOR_GREY, "USAGE: /addgasstaion [Rate] [Name]");
  2422. return 1;
  2423. }
  2424. AddGasStation(playerid, rate, tmp);
  2425. SendClientMessage(playerid, COLOR_GREEN, "Gas Station added...");
  2426. return 1;
  2427. }
  2428. }else if(strcmp(cmd, "/loadgasstations", true) == 0){
  2429. if(IsPlayerAdministrator(playerid, 1338)){
  2430. if(LoadGasStations()) SendClientMessage(playerid, COLOR_GREEN, "Gas Stations Loaded...");
  2431. return 1;
  2432. }
  2433. }else if(strcmp(cmd, "/setcommand", true) ==0){
  2434. if(IsPlayerAdministrator(playerid, 1338)){
  2435. new Rank, Type;
  2436. tmp = strtok(cmdtext, idx);
  2437. if(!strlen(tmp)){
  2438. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setcommand [Rank] [Type] [Command]");
  2439. return 1;
  2440. }
  2441. Rank = strval(tmp);
  2442. tmp = strtok(cmdtext, idx);
  2443. if(!strlen(tmp)){
  2444. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setcommand [Rank] [Type] [Command]");
  2445. return 1;
  2446. }
  2447. Type = strval(tmp);
  2448. tmp = strtok(cmdtext, idx);
  2449. if(!strlen(tmp)){
  2450. SendClientMessage(playerid, COLOR_GREY, "USAGE: /setcommand [Rank] [Type] [Command]");
  2451. return 1;
  2452. }
  2453. AddUsableCommand(Rank, Type, tmp);
  2454. SendClientMessage(playerid, COLOR_GREEN, "Command added to usable...");
  2455. return 1;
  2456. }
  2457. }else if(strcmp(cmd, "/loadcommands", true) == 0){
  2458. if(IsPlayerAdministrator(playerid, 1338)){
  2459. tmp = strtok(cmdtext, idx);
  2460. if(!strlen(tmp)){
  2461. SendClientMessage(playerid, COLOR_GREY, "USAGE: /loadcommands [Type]");
  2462. return 1;
  2463. }
  2464. if(LoadUsableCommands(strval(tmp))) SendClientMessage(playerid, COLOR_GREEN, "Commands Loaded...");
  2465. return 1;
  2466. }
  2467. }else{
  2468. SendClientMessage(playerid, COLOR_RED, "Unknown command.");
  2469. return 1;
  2470. }
  2471. return 1;
  2472. }
  2473. public OnPlayerPickUpPickup(playerid, pickupid){
  2474. new PickUpString[256];
  2475. if(PickUps[pickupid][puModel] == 1273){
  2476. for(new i = 0; i < MAX_HOUSES; i++){
  2477. if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
  2478. if(HouseInfos[i][OnSale] == 1){
  2479. format(PickUpString, sizeof(PickUpString), "~g~This house is on sale~n~~b~Price~b~ ~w~%d$~w~", HouseInfos[i][Price]);
  2480. GameTextForPlayer(playerid, PickUpString, 3000, 6);
  2481. return 1;
  2482. }
  2483. if(HouseInfos[i][Locked] == 1){
  2484. format(PickUpString, sizeof(PickUpString), "~r~Locked", HouseInfos[i][Price]);
  2485. GameTextForPlayer(playerid, PickUpString, 3000, 6);
  2486. return 1;
  2487. }
  2488. }
  2489. }
  2490. }else if(PickUps[pickupid][puModel] == 1210){
  2491. new jS[128];
  2492. for(new ji = 0; ji < MAX_JOBS; ji++){
  2493. if(IsPlayerInRangeOfPoint(playerid, 2.0, Job_Infos[ji][jPos_X], Job_Infos[ji][jPos_Y], Job_Infos[ji][jPos_Z])){
  2494. format(jS, sizeof(jS), "~w~Type /job get to become: ~g~%s", Job_Infos[ji][jName]);
  2495. GameTextForPlayer(playerid, jS, 3000, 5);
  2496. }
  2497. }
  2498. }else if(PickUps[pickupid][puModel] == 1239){
  2499. new string_1239[128];
  2500. for(new bi = 0; bi < MAX_BUSINESS; bi++){
  2501. if(IsPlayerInRangeOfPoint(playerid, 2.0, Business_Infos[bi][bizEntrance_X], Business_Infos[bi][bizEntrance_Y], Business_Infos[bi][bizEntrance_Z])){
  2502. format(string_1239, sizeof(string_1239), "~w~Business: ~b~%s~n~~w~Owner: ~b~%s", Business_Infos[bi][bizName], Business_Infos[bi][bizOwner_Name]);
  2503. GameTextForPlayer(playerid, string_1239, 3000, 5);
  2504. }
  2505. }
  2506. }
  2507. return 1;
  2508. }
  2509. public OnPlayerStateChange(playerid, newstate, oldstate){
  2510. new str[128];
  2511. if(newstate == PLAYER_STATE_DRIVER){
  2512. new engine, lights, alarm, doors, bonnet, boot, objective;
  2513. new vehicleid = GetPlayerVehicleID(playerid);
  2514. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  2515. SpeedoTimer[playerid] = SetTimerEx("Speedo", 1000, true, "d", playerid);
  2516. ShowSpeedo[playerid] = 1;
  2517. if(Player_Infos[playerid][pSpawned_Vehicle] == vehicleid){
  2518. if(engine == 0){
  2519. SendClientMessage(playerid, COLOR_YELLOW, "Engine is off, press SPACE or type /e to start engine.");
  2520. return 1;
  2521. }
  2522. }
  2523. if(LoadedVehicles[vehicleid][vFaction] != Player_Infos[playerid][pFaction] && LoadedVehicles[vehicleid][vFaction_Rank] != Player_Infos[playerid][pFaction_Rank]){
  2524. new rank_name[32];
  2525. switch(LoadedVehicles[vehicleid][vFaction_Rank]){
  2526. case 1:{
  2527. format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_1_Name]);
  2528. }
  2529. case 2:{
  2530. format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_2_Name]);
  2531. }
  2532. case 3:{
  2533. format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_3_Name]);
  2534. }
  2535. case 4:{
  2536. format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_4_Name]);
  2537. }
  2538. case 5:{
  2539. format(rank_name, sizeof(rank_name), "%s", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fRank_5_Name]);
  2540. }
  2541. }
  2542. format(str, sizeof(str), "Only %s rank %d:%s can drive this vehicle.", Faction_Infos[LoadedVehicles[vehicleid][vFaction]][fFaction_Name], LoadedVehicles[vehicleid][vFaction_Rank], rank_name);
  2543. SendClientMessage(playerid, COLOR_BLUE, str);
  2544. RemovePlayerFromVehicle(playerid);
  2545. return 1;
  2546. }
  2547. }
  2548. if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER){
  2549. KillTimer(SpeedoTimer[playerid]);
  2550. ShowSpeedo[playerid] = 0;
  2551. }
  2552. return 1;
  2553. }
  2554. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger){
  2555. new str[128];
  2556. new engine, lights, alarm, doors, bonnet, boot, objective;
  2557. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
  2558. if(ispassenger){
  2559. return 1;
  2560. }
  2561. if(doors && !IsPlayerAdministrator(playerid, 1) && Player_Infos[playerid][pSpawned_Vehicle] != -1 || Player_Infos[playerid][pSpawned_Vehicle] != vehicleid){
  2562. TogglePlayerControllable(playerid, 0);
  2563. Player_Infos[playerid][pStealing] = 1;
  2564. format(str, sizeof(str), "***%s is hijacking vehicle***", Player_Infos[playerid][pName]);
  2565. SendToNearPlayers(playerid, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE,COLOR_PURPLE, COLOR_PURPLE, 20.0, str);
  2566. SendClientMessage(playerid, COLOR_YELLOW, "Press [RETURN] button to cancel");
  2567. Player_Infos[playerid][pStealingTimer] = SetTimerEx("StealVehicle", 10000, false, "dd", playerid, vehicleid);
  2568. GameTextForPlayer(playerid, "Hijacking vehicle...", 10000, 6);
  2569. return 1;
  2570. }
  2571. return 1;
  2572. }
  2573. public OnPlayerExitVehicle(playerid, vehicleid){
  2574. if(ShowSpeedo[playerid] != 0){
  2575. KillTimer(SpeedoTimer[playerid]);
  2576. ShowSpeedo[playerid] = 0;
  2577. }
  2578. return 1;
  2579. }
  2580. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  2581. new Dialog_Player_Name[128];
  2582. GetPlayerName(playerid, Dialog_Player_Name, sizeof(Dialog_Player_Name));
  2583. if(dialogid == 1){
  2584. if(!response){
  2585. Kick(playerid);
  2586. return 1;
  2587. }
  2588. LoginPlayer(Dialog_Player_Name, inputtext);
  2589. return 0;
  2590. }
  2591. if(dialogid == 2){
  2592. if(!response){
  2593. Kick(playerid);
  2594. return 1;
  2595. }
  2596. if(strlen(inputtext) < 5){
  2597. SendClientMessage(playerid, COLOR_RED, "Password must have at least 5 characters");
  2598. ShowPlayerDialog(playerid, 2, 1, "Register", "Type your password bellow", "Register", "Close");
  2599. return 1;
  2600. }
  2601. RegisterPlayer(playerid, inputtext);
  2602. }
  2603. if(dialogid == 3 && response){
  2604. if(strlen(inputtext) <= 5){
  2605. SendClientMessage(playerid, COLOR_RED, "House/Street name must be at least 6 characters");
  2606. ShowPlayerDialog(playerid, 3, 1, "Create House. Step 1", "House/Street Name:", "Next", "Exit");
  2607. return 1;
  2608. }
  2609. format(HouseCreatingName, sizeof(HouseCreatingName), "%s", inputtext);
  2610. ShowPlayerDialog(playerid, 4, 1, "Create House. Step 2", "House price:", "Next", "Exit");
  2611. return 1;
  2612. }
  2613. if(dialogid == 4 && response){
  2614. if(strval(inputtext) < 15000){
  2615. SendClientMessage(playerid, COLOR_RED, "House price must be at least 15000$");
  2616. ShowPlayerDialog(playerid, 4, 1, "Create House. Step 2", "House price:", "Next", "Exit");
  2617. return 1;
  2618. }
  2619. HouseCreatingPrice[playerid] = strval(inputtext);
  2620. ShowPlayerDialog(playerid, 5, 2, "Create House. Step 3", "House 1\r\nHouse 2\r\nHouse 3\r\nHouse 4\r\nHouse 5\r\nHouse 6\r\nHouse 7", "Next", "Exit");
  2621. }
  2622. if(dialogid == 5){
  2623. if(!response){
  2624. HouseCreatingName[playerid] = 0;
  2625. HouseCreatingPrice[playerid] = 0;
  2626. return 1;
  2627. }
  2628. new Float:PlayerX, Float:PlayerY, Float:PlayerZ;
  2629. GetPlayerPos(playerid, PlayerX, PlayerY, PlayerZ);
  2630. switch(listitem){
  2631. case 0:{
  2632. CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 235.508994, 1189.169897, 1080.339966, 3);
  2633. LoadHouses();
  2634. return 1;
  2635. }
  2636. case 1:{
  2637. CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 225.756989, 1240.000000, 1082.149902, 2);
  2638. LoadHouses();
  2639. return 1;
  2640. }
  2641. case 2:{
  2642. CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 223.043991, 1289.259888, 1082.199951 , 1);
  2643. LoadHouses();
  2644. return 1;
  2645. }
  2646. case 3:{
  2647. CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 225.630997, 1022.479980, 1084.069946 , 7);
  2648. LoadHouses();
  2649. return 1;
  2650. }
  2651. case 4:{
  2652. CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 295.138977, 1474.469971, 1080.519897 , 15);
  2653. LoadHouses();
  2654. return 1;
  2655. }
  2656. case 5:{
  2657. CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 328.493988, 1480.589966, 1084.449951, 15);
  2658. LoadHouses();
  2659. return 1;
  2660. }
  2661. case 6:{
  2662. CreateHouse(HouseCreatingName[playerid], "For_Sale", HouseCreatingPrice[playerid], 1, 1, PlayerX, PlayerY, PlayerZ, 385.803986, 1471.769897, 1080.209961, 15);
  2663. LoadHouses();
  2664. return 1;
  2665. }
  2666. }
  2667.  
  2668. }
  2669. return 1;
  2670. }
  2671. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys){
  2672. if(newkeys & KEY_SECONDARY_ATTACK){
  2673. if(Player_Infos[playerid][pStealing] == 1){
  2674. KillTimer(Player_Infos[playerid][pStealingTimer]);
  2675. TogglePlayerControllable(playerid, 1);
  2676. return 1;
  2677. }
  2678. if(!IsPlayerInAnyVehicle(playerid)){
  2679. if(Player_Infos[playerid][pInObject] != -1){
  2680. RemovePlayerFromObject(playerid);
  2681. return 1;
  2682. }else{
  2683. PutPlayerInObject(playerid);
  2684. return 1;
  2685. }
  2686. }
  2687. }else if(newkeys & KEY_HANDBRAKE){
  2688. if(IsPlayerInAnyVehicle(playerid)){
  2689. new VehicleID;
  2690. if(Player_Infos[playerid][pFueling] == 1){
  2691. SendClientMessage(playerid, COLOR_RED, "You can not start engine, fueling...");
  2692. return 1;
  2693. }
  2694. VehicleID = GetPlayerVehicleID(playerid);
  2695. new engine, lights, alarm, doors, bonnet, boot, objective;
  2696. GetVehicleParamsEx(VehicleID, engine, lights, alarm, doors, bonnet, boot, objective);
  2697. if(engine == 0){
  2698. if(VehicleFuel[VehicleID] == 0){
  2699. SendClientMessage(playerid, COLOR_YELLOW, "No fuel, you cant start engine.");
  2700. return 1;
  2701. }
  2702. GameTextForPlayer(playerid, "~b~Starting engine", 2000, 5);
  2703. SetTimerEx("SwitchEngineOn", 2000, false, "dd", playerid, VehicleID);
  2704. }
  2705. return 1;
  2706. }
  2707. }
  2708. return 1;
  2709. }
  2710. public AddSpeedCam(playerid, maxspeed){
  2711. new File:Handler = fopen("speedcams.txt", io_append);
  2712. new Float:X, Float:Y, Float:Z, Float:FA, String[128];
  2713. GetPlayerPos(playerid, X, Y, Z);
  2714. GetPlayerFacingAngle(playerid, FA);
  2715. format(String, sizeof(String), "%d,%f,%f,%f,%f\n", maxspeed, X, Y, Z, FA);
  2716. if(!fwrite(Handler, String)) return false;
  2717. if(!fclose(Handler)) return false;
  2718. return true;
  2719. }
  2720. public LoadSpeedCams(){
  2721. if(!dini_Exists("speedcams.txt")){
  2722. return 1;
  2723. }
  2724. new File:Handler = fopen("speedcams.txt", io_read);
  2725. for(new i = 0; i < MAX_SPEEDCAMS; i++){
  2726. if(SpeedCams[i][scmaxspeed]){
  2727. DestroyObject(SpeedCams[i][scobjid]);
  2728. }
  2729. }
  2730. new String[256], SplitString[6][24];
  2731. new sc = 0;
  2732. while(fread(Handler, String)){
  2733. split(String, SplitString, ',');
  2734. SpeedCams[sc][scmaxspeed] = strval(SplitString[0]);
  2735. SpeedCams[sc][scx] = strval(SplitString[1]);
  2736. SpeedCams[sc][scy] = strval(SplitString[2]);
  2737. SpeedCams[sc][scz] = strval(SplitString[3]);
  2738. SpeedCams[sc][scfa] = strval(SplitString[4]);
  2739. SpeedCams[sc][scobjid] = CreateObject(18880, SpeedCams[sc][scx], SpeedCams[sc][scy], SpeedCams[sc][scz] - 1, 0.0, 0.0, SpeedCams[sc][scfa]);
  2740. sc++;
  2741. }
  2742. fclose(Handler);
  2743. return true;
  2744. }
  2745. public SpeedCamsTimer(){
  2746. new String[256], Float:tmpX, Float:tmpY;
  2747. for(new i = 0; i < MAX_PLAYERS; i++){
  2748. new State = GetPlayerState(i);
  2749. if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerSpeed(i, true) > 0 && State == PLAYER_STATE_DRIVER){
  2750. for(new p = 0; p < MAX_SPEEDCAMS; p++){
  2751. tmpX = SpeedCams[p][scx];
  2752. tmpY = SpeedCams[p][scy];
  2753. GetDirectedXY(2, p, tmpX, tmpY, 5.0, 1);
  2754. if(IsPlayerInRangeOfPoint(i, 20.0, tmpX, tmpY, SpeedCams[p][scz])){
  2755. new CSpeed;
  2756. CSpeed = GetPlayerSpeed(i, true);
  2757. if(CSpeed > SpeedCams[p][scmaxspeed] && SpeedCamPlayer[i] == 0){
  2758. SpeedCamPlayer[i] = 1;
  2759. Player_Infos[i][pFines] = Player_Infos[i][pFines] + 150;
  2760. format(String, sizeof(String), "You were cought on speed cam(%d/%d), you have to pay %d$ of fines.", CSpeed, SpeedCams[p][scmaxspeed], Player_Infos[i][pFines]);
  2761. SendClientMessage(i, COLOR_RED, String);
  2762. SetTimerEx("SpeedCamCheck", 5000, false, "d", i);
  2763. }
  2764. }
  2765. }
  2766. }
  2767. }
  2768. }
  2769. public SpeedCamCheck(playerid){
  2770. SpeedCamPlayer[playerid] = 0;
  2771. return 1;
  2772. }
  2773. public AddGasStation(playerid, rate, name[]){
  2774. new File:Handler = fopen("gasstations.txt", io_append);
  2775. new String[256], Float:X, Float:Y, Float:Z;
  2776. GetPlayerPos(playerid, X, Y, Z);
  2777. format(String, sizeof(String), "%s,%d,%f,%f,%f\n", name, rate, X, Y, Z);
  2778. if(!fwrite(Handler, String)) return false;
  2779. if(!fclose(Handler)) return false;
  2780. return true;
  2781. }
  2782. public LoadGasStations(){
  2783. if(!fexist("gasstations.txt")){
  2784. return 1;
  2785. }
  2786. new File:Handler = fopen("gasstations.txt", io_read);
  2787. new String[256], SplitString[6][24];
  2788. new GS = 0;
  2789. while(fread(Handler, String)){
  2790. split(String, SplitString, ',');
  2791. format(GasStations[GS][gssname], 24, "%s", SplitString[0]);
  2792. GasStations[GS][gssrate] = strval(SplitString[1]);
  2793. GasStations[GS][gssx] = floatstr(SplitString[2]);
  2794. GasStations[GS][gssy] = floatstr(SplitString[3]);
  2795. GasStations[GS][gssz] = floatstr(SplitString[4]);
  2796. GS++;
  2797. }
  2798. fclose(Handler);
  2799. return 1;
  2800. }
  2801. public Fueling(playerid, vehicleid, money){
  2802. new str[128];
  2803. format(str, sizeof(str), "~w~Fueling: ~g~Finished. ~y~You paid ~r~%d$ ~y~for fuel...", money);
  2804. GameTextForPlayer(playerid, str, 3000, 4);
  2805. Player_Infos[playerid][pFueling] = 0;
  2806. VehicleFuel[vehicleid] = 100;
  2807. if(vehicleid == Player_Infos[playerid][pSpawned_Vehicle]){
  2808. switch(Player_Infos[playerid][pSpawned_Vehicle_Slot]){
  2809. case 1:{
  2810. Player_Infos[playerid][pVehicle_1_Fuel] = 100;
  2811. }
  2812. case 2:{
  2813. Player_Infos[playerid][pVehicle_2_Fuel] = 100;
  2814. }
  2815. case 3:{
  2816. Player_Infos[playerid][pVehicle_3_Fuel] = 100;
  2817. }
  2818. }
  2819. }
  2820. GivePlayerCash(playerid, -money);
  2821. return 1;
  2822. }
  2823. public AddVehicle(model, Float:x, Float:y, Float:z, Float:facing_angle, color_1, color_2, faction, faction_rank){
  2824. new File:Vehicles = fopen("vehicles.txt", io_append);
  2825. new Params[256];
  2826. format(Params, sizeof(Params), "%d,%f,%f,%f,%f,%d,%d,%d,%d\n\r", model, x, y, z, facing_angle, color_1, color_2, faction, faction_rank);
  2827. fwrite(Vehicles, Params);
  2828. fclose(Vehicles);
  2829. return 1;
  2830. }
  2831. public LoadVehicles(static_vehicle){
  2832. print("Loading vehicles...");
  2833. if(!fexist("vehicles.txt")){
  2834. return true;
  2835. }
  2836. new Vehicles_Params[256], Vehicle_Param[10][20], Created_Vehicle, Plate[20];
  2837. new File:LoadVehiclesFile = fopen("vehicles.txt", io_read);
  2838. while(fread(LoadVehiclesFile, Vehicles_Params)){
  2839. new Can_Create = 1;
  2840. split(Vehicles_Params, Vehicle_Param, ',');
  2841. for(new i = 0; i < MAX_VEHICLES; i++){
  2842. if(LoadedVehicles[i][vModel_ID] == strval(Vehicle_Param[0]) && LoadedVehicles[i][vx] == floatstr(Vehicle_Param[1]) && LoadedVehicles[i][vy] == floatstr(Vehicle_Param[2]) && LoadedVehicles[i][vz] == floatstr(Vehicle_Param[3]) && LoadedVehicles[i][vFacing_Angle] == floatstr(Vehicle_Param[4])){
  2843. Can_Create = 0;
  2844. }
  2845. }
  2846. if(Can_Create == 1){
  2847. if(static_vehicle == 0){
  2848. Created_Vehicle = CreateVehicle(strval(Vehicle_Param[0]), floatstr(Vehicle_Param[1]), floatstr(Vehicle_Param[2]), floatstr(Vehicle_Param[3]), floatstr(Vehicle_Param[4]), strval(Vehicle_Param[5]), strval(Vehicle_Param[6]), 1800);
  2849. }else{
  2850. Created_Vehicle = AddStaticVehicleEx(strval(Vehicle_Param[0]), floatstr(Vehicle_Param[1]), floatstr(Vehicle_Param[2]), floatstr(Vehicle_Param[3]), floatstr(Vehicle_Param[4]), strval(Vehicle_Param[5]), strval(Vehicle_Param[6]), 1800);
  2851. }
  2852. VehicleFuel[Created_Vehicle] = 100;
  2853. SetVehicleParamsEx(Created_Vehicle, 0, 0, 0, 0, 0, 0, 0);
  2854. LoadedVehicles[Created_Vehicle][vModel_ID] = strval(Vehicle_Param[0]);
  2855. LoadedVehicles[Created_Vehicle][vx] = floatstr(Vehicle_Param[1]);
  2856. LoadedVehicles[Created_Vehicle][vy] = floatstr(Vehicle_Param[2]);
  2857. LoadedVehicles[Created_Vehicle][vz] = floatstr(Vehicle_Param[3]);
  2858. LoadedVehicles[Created_Vehicle][vFacing_Angle] = floatstr(Vehicle_Param[4]);
  2859. LoadedVehicles[Created_Vehicle][vColor_1] = strval(Vehicle_Param[5]);
  2860. LoadedVehicles[Created_Vehicle][vColor_2] = strval(Vehicle_Param[6]);
  2861. LoadedVehicles[Created_Vehicle][vFaction] = strval(Vehicle_Param[7]);
  2862. LoadedVehicles[Created_Vehicle][vFaction_Rank] = strval(Vehicle_Param[8]);
  2863. format(Plate, sizeof(Plate), "LH-%d",Created_Vehicle);
  2864. SetVehicleNumberPlate(Created_Vehicle, Plate);
  2865. }
  2866. }
  2867. fclose(LoadVehiclesFile);
  2868. return 1;
  2869. }
  2870. public AddBank(Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid){
  2871. new Float:My_X, Float:My_Y, Float:My_Z, Bank_Data[256];
  2872. new File:Banks = fopen("banks.txt", io_append);
  2873. GetPlayerPos(playerid, My_X, My_Y, My_Z);
  2874. format(Bank_Data, sizeof(Bank_Data), "%f,%f,%f,%d,%f,%f,%f\n", Inside_X, Inside_Y, Inside_Z, Interior, My_X, My_Y, My_Z);
  2875. fwrite(Banks, Bank_Data);
  2876. fclose(Banks);
  2877. return 1;
  2878. }
  2879. public LoadBanks(){
  2880. new File:BanksToLoad = fopen("banks.txt", io_read);
  2881. print("Loading Banks...");
  2882. if(!dini_Exists("banks.txt")){
  2883. print("No banks...");
  2884. return 1;
  2885. }
  2886. new banks = 0;
  2887. new bstring[256], bsplit[8][32];
  2888. while(fread(BanksToLoad, bstring)){
  2889. split(bstring, bsplit, ',');
  2890. BankInfos[banks][BankEnterX] = floatstr(bsplit[0]);
  2891. BankInfos[banks][BankEnterY] = floatstr(bsplit[1]);
  2892. BankInfos[banks][BankEnterZ] = floatstr(bsplit[2]);
  2893. BankInfos[banks][BankInteriorID] = strval(bsplit[3]);
  2894. BankInfos[banks][BankExitX] = floatstr(bsplit[4]);
  2895. BankInfos[banks][BankExitY] = floatstr(bsplit[5]);
  2896. BankInfos[banks][BankExitZ] = floatstr(bsplit[6]);
  2897. CreatePickupEx(1274, 1, BankInfos[banks][BankExitX], BankInfos[banks][BankExitY], BankInfos[banks][BankExitZ], 0);
  2898. print("Bank Loaded");
  2899. banks++;
  2900. }
  2901. return 1;
  2902. }
  2903. public AddFaction(const Name[], type){
  2904. new File:Factions = fopen("factions.txt", io_append);
  2905. new Faction_Data[128], Faction_String[64];
  2906. format(Faction_Data, sizeof(Faction_Data), "%s,%d\n", Name, type);
  2907. fwrite(Factions, Faction_Data);
  2908. fclose(Factions);
  2909. format(Faction_String, sizeof(Faction_String), "Factions/%s_Ranks.ini", Name);
  2910. dini_Create(Faction_String);
  2911. format(Faction_String, sizeof(Faction_String), "Factions/%s_Skins.ini", Name);
  2912. dini_Create(Faction_String);
  2913. format(Faction_String, sizeof(Faction_String), "Factions/%s_HQ.ini", Name);
  2914. dini_Create(Faction_String);
  2915. return 1;
  2916. }
  2917. public SetFactionRankName(const Faction_Name[], Rank, const Rank_Name[]){
  2918. new Faction_Name_Rank[128], Faction_Rank_Name[128], Faction_Rank[64];
  2919. format(Faction_Name_Rank, sizeof(Faction_Name_Rank), "Factions/%s_Ranks.ini", Faction_Name);
  2920. if(!dini_Exists(Faction_Name_Rank)){
  2921. return 1;
  2922. }
  2923. format(Faction_Rank_Name, sizeof(Faction_Rank_Name), "%s", Rank_Name);
  2924. format(Faction_Rank, sizeof(Faction_Rank), "%d", Rank);
  2925. dini_Set(Faction_Name_Rank, Faction_Rank, Faction_Rank_Name);
  2926. LoadFactions();
  2927. return 1;
  2928. }
  2929. public SetFactionRankSkin(const Faction_Name[], Rank, SkinID){
  2930. new Faction_Skin[128], Faction_Skin_Rank[128];
  2931. format(Faction_Skin, sizeof(Faction_Skin), "Factions/%s_Skins.ini", Faction_Name);
  2932. if(!dini_Exists(Faction_Skin)){
  2933. return 1;
  2934. }
  2935. format(Faction_Skin_Rank, sizeof(Faction_Skin_Rank), "%d", Rank);
  2936. dini_IntSet(Faction_Skin, Faction_Skin_Rank, SkinID);
  2937. LoadFactions();
  2938. return 1;
  2939. }
  2940. public AddFactionHQ(const Faction_HQ_Name[], Float:Inside_X, Float:Inside_Y, Float:Inside_Z, Interior, playerid){
  2941. new Float:My_X, Float:My_Y, Float:My_Z, HQ_String[128];
  2942. GetPlayerPos(playerid, My_X, My_Y, My_Z);
  2943. format(HQ_String, sizeof(HQ_String), "Factions/%s_HQ.ini", Faction_HQ_Name);
  2944. if(!dini_Exists(HQ_String)){
  2945. print(HQ_String);
  2946. return 1;
  2947. }
  2948. dini_FloatSet(HQ_String, "Entrance_X", My_X);
  2949. dini_FloatSet(HQ_String, "Entrance_Y", My_Y);
  2950. dini_FloatSet(HQ_String, "Entrance_Z", My_Z);
  2951. dini_FloatSet(HQ_String, "Inside_X", Inside_X);
  2952. dini_FloatSet(HQ_String, "Inside_Y", Inside_Y);
  2953. dini_FloatSet(HQ_String, "Inside_Z", Inside_Z);
  2954. dini_IntSet(HQ_String, "Interior", Interior);
  2955. LoadFactions();
  2956. return 1;
  2957. }
  2958. public LoadFactions(){
  2959. print("Loading factions...");
  2960. new File:FactionsToLoad = fopen("factions.txt", io_read);
  2961. if(!dini_Exists("factions.txt")){
  2962. return 1;
  2963. }
  2964. new faction = 0;
  2965. new fstring[128], fsplit[3][128], load_hq[64], load_ranks[64], load_skins[64], sstring[128];
  2966. while(fread(FactionsToLoad, fstring)){
  2967. split(fstring, fsplit, ',');
  2968. format(Faction_Infos[faction][fFaction_Name], 128, "%s", fsplit[0]);
  2969. Faction_Infos[faction][fFaction_Type] = strval(fsplit[1]);
  2970. format(load_hq, sizeof(load_hq), "Factions/%s_HQ.ini", fsplit[0]);
  2971. Faction_Infos[faction][fFaction_HQ_X] = dini_Float(load_hq, "Entrance_X");
  2972. Faction_Infos[faction][fFaction_HQ_Y] = dini_Float(load_hq, "Entrance_Y");
  2973. Faction_Infos[faction][fFaction_HQ_Z] = dini_Float(load_hq, "Entrance_Z");
  2974. Faction_Infos[faction][fFaction_HQ_Inside_X] = dini_Float(load_hq, "Inside_X");
  2975. Faction_Infos[faction][fFaction_HQ_Inside_Y] = dini_Float(load_hq, "Inside_Y");
  2976. Faction_Infos[faction][fFaction_HQ_Inside_Z] = dini_Float(load_hq, "Inside_Z");
  2977. Faction_Infos[faction][fFaction_HQ_Inside_Interior] = dini_Int(load_hq, "Interior");
  2978. format(load_ranks, sizeof(load_ranks), "Factions/%s_Ranks.ini", fsplit[0]);
  2979. format(Faction_Infos[faction][fRank_1_Name], 64, "%s",dini_Get(load_ranks, "1"));
  2980. format(Faction_Infos[faction][fRank_2_Name], 64, "%s",dini_Get(load_ranks, "2"));
  2981. format(Faction_Infos[faction][fRank_3_Name], 64, "%s",dini_Get(load_ranks, "3"));
  2982. format(Faction_Infos[faction][fRank_4_Name], 64, "%s",dini_Get(load_ranks, "4"));
  2983. format(Faction_Infos[faction][fRank_5_Name], 64, "%s",dini_Get(load_ranks, "5"));
  2984. format(load_skins, sizeof(load_skins), "Factions/%s_Skins.ini", fsplit[0]);
  2985. Faction_Infos[faction][fRank_1_Skin] = dini_Int(load_skins, "1");
  2986. Faction_Infos[faction][fRank_2_Skin] = dini_Int(load_skins, "2");
  2987. Faction_Infos[faction][fRank_3_Skin] = dini_Int(load_skins, "3");
  2988. Faction_Infos[faction][fRank_4_Skin] = dini_Int(load_skins, "4");
  2989. Faction_Infos[faction][fRank_5_Skin] = dini_Int(load_skins, "5");
  2990. format(sstring, sizeof(sstring), "Faction: %s loaded", fsplit[0]);
  2991. Create3DTextLabel(Faction_Infos[faction][fFaction_Name], 0x0000BBAA, Faction_Infos[faction][fFaction_HQ_X], Faction_Infos[faction][fFaction_HQ_Y], Faction_Infos[faction][fFaction_HQ_Z], 20, 0, 0);
  2992. CreatePickupEx(1272, 1, Faction_Infos[faction][fFaction_HQ_X], Faction_Infos[faction][fFaction_HQ_Y], Faction_Infos[faction][fFaction_HQ_Z], 0);
  2993. SendClientMessageToAll(COLOR_YELLOW, sstring);
  2994. print(sstring);
  2995. faction++;
  2996. }
  2997. fclose(FactionsToLoad);
  2998. return 1;
  2999. }
  3000. public CreateHouse(const housename[], const owner[], price, locked, onsale, Float:x, Float:y, Float:z, Float:ix, Float:iy, Float:iz, interior){
  3001. new File:Houses = fopen("houses.txt", io_append);
  3002. new String[256];
  3003. format(String, sizeof(String), "%s,%s,%d,%d,%d,%f,%f,%f,%f,%f,%f,%d\r\n", housename, owner, price, locked, onsale, x, y, z, ix, iy, iz, interior);
  3004. fwrite(Houses, String);
  3005. fclose(Houses);
  3006. format(String, sizeof(String), "house_store/%s_weapons.ini", housename);
  3007. dini_Create(String);
  3008. format(String, sizeof(String), "house_store/%s_money.ini", housename);
  3009. dini_Create(String);
  3010. format(String, sizeof(String), "house_store/%s_drugs.ini", housename);
  3011. dini_Create(String);
  3012. return 1;
  3013. }
  3014.  
  3015. public LoadHouses(){
  3016. print("Loading houses...");
  3017. if(!fexist("houses.txt")){
  3018. return true;
  3019. }
  3020. new File:LoadHouse = fopen("houses.txt", io_read);
  3021. new LoadString[256];
  3022. new String[64];
  3023. new ID = 0;
  3024. new SplitString[12][64];
  3025. while(fread(LoadHouse, LoadString)){
  3026. split(LoadString, SplitString, ',');
  3027. HouseInfos[ID][HouseName] = SplitString[0];
  3028. HouseInfos[ID][OwnerName] = SplitString[1];
  3029. HouseInfos[ID][Price] = strval(SplitString[2]);
  3030. HouseInfos[ID][Locked] = strval(SplitString[3]);
  3031. HouseInfos[ID][OnSale] = strval(SplitString[4]);
  3032. HouseInfos[ID][HouseEnterX] = floatstr(SplitString[5]);
  3033. HouseInfos[ID][HouseEnterY] = floatstr(SplitString[6]);
  3034. HouseInfos[ID][HouseEnterZ] = floatstr(SplitString[7]);
  3035. HouseInfos[ID][HouseInteriorX] = floatstr(SplitString[8]);
  3036. HouseInfos[ID][HouseInteriorY] = floatstr(SplitString[9]);
  3037. HouseInfos[ID][HouseInteriorZ] = floatstr(SplitString[10]);
  3038. HouseInfos[ID][HouseInteriorID] = strval(SplitString[11]);
  3039. format(String, sizeof(String), "%s , Owner: %s", HouseInfos[ID][HouseName], HouseInfos[ID][OwnerName]);
  3040. HouseInfos[ID][hTextLabelID] = Create3DTextLabel(String, 0x0000BBAA, HouseInfos[ID][HouseEnterX], HouseInfos[ID][HouseEnterY], HouseInfos[ID][HouseEnterZ], 20, 0, 0);
  3041. HouseInfos[ID][hPickup_ID] = CreatePickupEx(1273, 1, HouseInfos[ID][HouseEnterX], HouseInfos[ID][HouseEnterY], HouseInfos[ID][HouseEnterZ], 0);
  3042. ID++;
  3043. }
  3044. fclose(LoadHouse);
  3045. return 1;
  3046. }
  3047. public AddBusiness(playerid, const Business_Name[], const bOwner_Name[], bEnter_Fee, bOnSale, bPrice, bLocked, Float:Interior_X, Float:Interior_Y, Float:Interior_Z, bInterior){
  3048. new Float:bX, Float:bY, Float:bZ, bString[128];
  3049. GetPlayerPos(playerid, bX, bY, bZ);
  3050. format(bString, sizeof(bString), "%s,%s,%d,%d,%d,%d,%f,%f,%f,%d,%f,%f,%f\n", Business_Name, bOwner_Name, bEnter_Fee, bOnSale, bPrice, bLocked, Interior_X, Interior_Y, Interior_Z, bInterior, bX, bY,bZ);
  3051. new File:BusinessAdd = fopen("business.txt", io_append);
  3052. fwrite(BusinessAdd, bString);
  3053. fclose(BusinessAdd);
  3054. return 1;
  3055. }
  3056. public ReloadBusinessFile(){
  3057. new bString[256], LB_String[128];
  3058. fremove("business.txt");
  3059. new File:BusinessReload = fopen("business.txt", io_append);
  3060. for(new i = 0; i < MAX_BUSINESS; i++){
  3061. if(strlen(Business_Infos[i][bizName]) != 0){
  3062.  
  3063. format(bString, sizeof(bString), "%s,%s,%d,%d,%d,%d,%f,%f,%f,%d,%f,%f,%f\n", Business_Infos[i][bizName], Business_Infos[i][bizOwner_Name], Business_Infos[i][bizEnter_Fee], Business_Infos[i][bizOn_Sale], Business_Infos[i][bizPrice], Business_Infos[i][bizLocked], Business_Infos[i][bizInterior_Z], Business_Infos[i][bizInterior_Y], Business_Infos[i][bizInterior_Z], Business_Infos[i][bizInterior], Business_Infos[i][bizEntrance_X], Business_Infos[i][bizEntrance_Y], Business_Infos[i][bizEntrance_Z]);
  3064. format(LB_String, 128, "Business: %s\n\rOwner: %s", Business_Infos[i][bizName], Business_Infos[i][bizOwner_Name]);
  3065. Update3DTextLabelText(Business_Infos[i][labelid], COLOR_GREEN, LB_String);
  3066. fwrite(BusinessReload, bString);
  3067. }
  3068. }
  3069. fclose(BusinessReload);
  3070. return 1;
  3071. }
  3072. public LoadBusiness(){
  3073. print("Loading business...");
  3074. new Load_Biz_String[128], LBS[256], LBSS[13][64], LB_String[128];
  3075. format(Load_Biz_String, sizeof(Load_Biz_String), "business.txt");
  3076. if(!dini_Exists(Load_Biz_String)){
  3077. return 1;
  3078. }
  3079. new File:LoadBusinessFile = fopen(Load_Biz_String, io_read);
  3080. new bid = 0;
  3081. while(fread(LoadBusinessFile, LBS)){
  3082. split(LBS, LBSS, ',');
  3083. Business_Infos[bid][bizName] = LBSS[0];
  3084. Business_Infos[bid][bizOwner_Name] = LBSS[1];
  3085. Business_Infos[bid][bizEnter_Fee] = strval(LBSS[2]);
  3086. Business_Infos[bid][bizOn_Sale] = strval(LBSS[3]);
  3087. Business_Infos[bid][bizPrice] = strval(LBSS[4]);
  3088. Business_Infos[bid][bizLocked] = strval(LBSS[5]);
  3089. Business_Infos[bid][bizInterior_X] = floatstr(LBSS[6]);
  3090. Business_Infos[bid][bizInterior_Y] = floatstr(LBSS[7]);
  3091. Business_Infos[bid][bizInterior_Z] = floatstr(LBSS[8]);
  3092. Business_Infos[bid][bizInterior] = strval(LBSS[9]);
  3093. Business_Infos[bid][bizEntrance_X] = floatstr(LBSS[10]);
  3094. Business_Infos[bid][bizEntrance_Y] = floatstr(LBSS[11]);
  3095. Business_Infos[bid][bizEntrance_Z] = floatstr(LBSS[12]);
  3096. format(LB_String, 128, "Business: %s\n\rOwner: %s", Business_Infos[bid][bizName], Business_Infos[bid][bizOwner_Name]);
  3097. Business_Infos[bid][labelid] = Create3DTextLabel(LB_String, COLOR_BLUE, Business_Infos[bid][bizEntrance_X], Business_Infos[bid][bizEntrance_Y], Business_Infos[bid][bizEntrance_Z], 20, 0, 0);
  3098. CreatePickupEx(1239, 1, Business_Infos[bid][bizEntrance_X], Business_Infos[bid][bizEntrance_Y], Business_Infos[bid][bizEntrance_Z], 0);
  3099. bid++;
  3100. }
  3101. fclose(LoadBusinessFile);
  3102. return 1;
  3103. }
  3104. public SetVehicleSpawn(shopid, playerid){
  3105. new File:Handler = fopen("vehicle_spawns.txt", io_append);
  3106. new String[128], Float:X, Float:Y, Float:Z, Float:FA;
  3107. GetPlayerPos(playerid, X, Y, Z);
  3108. GetPlayerFacingAngle(playerid, FA);
  3109. format(String, sizeof(String), "%d,%f,%f,%f,%f\n", shopid, X, Y, Z, FA);
  3110. if(!fwrite(Handler, String)) return false;
  3111. if(!fclose(Handler)) return false;
  3112. return true;
  3113. }
  3114. public LoadVehicleSpawns(){
  3115. if(!dini_Exists("vehicle_spawns.txt")){
  3116. print("No vehicle spawns yet :D");
  3117. return 1;
  3118. }
  3119. new File:HandlerVS = fopen("vehicle_spawns.txt", io_read);
  3120. new StringVS[256], SplitStringVS[6][24];
  3121. while(fread(HandlerVS, StringVS)){
  3122. split(StringVS, SplitStringVS, ',');
  3123. if(strlen(Vehicles_Shops[strval(SplitStringVS[0])][vsName])){
  3124. Vehicles_Shops[strval(SplitStringVS[0])][vsvsx] = floatstr(SplitStringVS[1]);
  3125. Vehicles_Shops[strval(SplitStringVS[0])][vsvsy] = floatstr(SplitStringVS[2]);
  3126. Vehicles_Shops[strval(SplitStringVS[0])][vsvsz] = floatstr(SplitStringVS[3]);
  3127. Vehicles_Shops[strval(SplitStringVS[0])][vsvsfa] = floatstr(SplitStringVS[4]);
  3128. }
  3129. }
  3130. if(!fclose(HandlerVS)) return false;
  3131. return true;
  3132. }
  3133. public AddVehicleShop(playerid, const Vehicle_Shop_Name[]){
  3134. new Float:Vehicle_Shop_X, Float:Vehicle_Shop_Y, Float:Vehicle_Shop_Z, Vehicle_Shop_String[128];
  3135. new File:VehicleShop = fopen("vehicle_shops.txt", io_append);
  3136. GetPlayerPos(playerid, Vehicle_Shop_X, Vehicle_Shop_Y, Vehicle_Shop_Z);
  3137. format(Vehicle_Shop_String, sizeof(Vehicle_Shop_String), "%s,%f,%f,%f\n", Vehicle_Shop_Name, Vehicle_Shop_X, Vehicle_Shop_Y, Vehicle_Shop_Z);
  3138. fwrite(VehicleShop, Vehicle_Shop_String);
  3139. fclose(VehicleShop);
  3140. return 1;
  3141. }
  3142. public LoadVehicleShops(){
  3143. print("Loading vehicle shops...");
  3144. new Load_Vehicle_Shops_String[128], Load_Vehicle_Shop_String_Split[5][24], LS[128];
  3145. if(!dini_Exists("vehicle_shops.txt")){
  3146. return 1;
  3147. }
  3148. new File:LoadVehicleShop = fopen("vehicle_shops.txt", io_read);
  3149. new Vehicle_Shop_ID = 0;
  3150. while(fread(LoadVehicleShop, Load_Vehicle_Shops_String)){
  3151. split(Load_Vehicle_Shops_String, Load_Vehicle_Shop_String_Split, ',');
  3152. Vehicles_Shops[Vehicle_Shop_ID][vsName] = Load_Vehicle_Shop_String_Split[0];
  3153. Vehicles_Shops[Vehicle_Shop_ID][vsX] = floatstr(Load_Vehicle_Shop_String_Split[1]);
  3154. Vehicles_Shops[Vehicle_Shop_ID][vsY] = floatstr(Load_Vehicle_Shop_String_Split[2]);
  3155. Vehicles_Shops[Vehicle_Shop_ID][vsZ] = floatstr(Load_Vehicle_Shop_String_Split[3]);
  3156. format(LS, sizeof(LS), "Vehicle DealerShip:\n%s", Vehicles_Shops[Vehicle_Shop_ID][vsName]);
  3157. //CreatePickupEx(pickup_model, pickup_type, Float:pickup_X, Float:pickup_Y, Float:pickup_Z, pickup_virtualworld);
  3158. Create3DTextLabel(LS, COLOR_PURPLE, Vehicles_Shops[Vehicle_Shop_ID][vsX], Vehicles_Shops[Vehicle_Shop_ID][vsY], Vehicles_Shops[Vehicle_Shop_ID][vsZ], 20, 0, 0);
  3159. Vehicle_Shop_ID++;
  3160. }
  3161. fclose(LoadVehicleShop);
  3162. return 1;
  3163. }
  3164. public AddMapIcon(playerid, icon_type){
  3165. new Float:Map_X, Float:Map_Y, Float:Map_Z, write_string[128];
  3166. GetPlayerPos(playerid, Map_X, Map_Y, Map_Z);
  3167. new File:Mapicon = fopen("mapicon.txt", io_append);
  3168. format(write_string, sizeof(write_string), "%f,%f,%f,%d\n", Map_X, Map_Y, Map_Z, icon_type);
  3169. fwrite(Mapicon, write_string);
  3170. fclose(Mapicon);
  3171. return 1;
  3172. }
  3173. public LoadMapIcons(){
  3174. print("Loading map icons...");
  3175. if(!fexist("mapicon.txt")){
  3176. return true;
  3177. }
  3178. new File:MapIconLoad = fopen("mapicon.txt", io_read);
  3179. new String[128], SplitString[6][20];
  3180. new mid = 0;
  3181. while(fread(MapIconLoad, String)){
  3182. split(String, SplitString, ',');
  3183. for(new playerid = 0; playerid < MAX_PLAYERS; playerid++){
  3184. if(IsPlayerConnected(playerid)){
  3185. SetPlayerMapIcon(playerid, mid, floatstr(SplitString[0]), floatstr(SplitString[1]), floatstr(SplitString[2]), strval(SplitString[4]), 0, MAPICON_LOCAL);
  3186. }
  3187. }
  3188. mid++;
  3189. }
  3190. fclose(MapIconLoad);
  3191. return 1;
  3192. }
  3193. public LoginPlayer(const PlayerName[], const PlayerPassword[]){
  3194. new Login_String[128], pass, pass_new[128], id;
  3195. GetPlayerIDByName(PlayerName, id);
  3196. if(WrongPassword[id] == 3){
  3197. SendClientMessage(id, COLOR_RED, "You have type wrong password for three times, you have been kicked");
  3198. Kick(id);
  3199. return 1;
  3200. }
  3201. format(Login_String, 128, "Players/%s.ini", PlayerName);
  3202. if(!dini_Exists(Login_String)){
  3203. SendClientMessage(id, COLOR_RED, "Username is not registered, please register.");
  3204. return 1;
  3205. }
  3206. pass = dini_Int(Login_String, "Key");
  3207. format(pass_new, sizeof(pass_new), "%s", PlayerPassword);
  3208. if(udb_hash(pass_new) != pass){
  3209. SendClientMessage(id, COLOR_RED, "Wrong password.");
  3210. ShowPlayerDialog(id, 1, DIALOG_STYLE_PASSWORD, "Login", "Wrong password please try again", "Login", "Close");
  3211. WrongPassword[id]++;
  3212. return 1;
  3213. }
  3214. Player_Infos[id][pKey] = pass;
  3215. format(Player_Infos[id][pName], 128, "%s", PlayerName);
  3216. Player_Infos[id][pLevel] = dini_Int(Login_String, "Level");
  3217. Player_Infos[id][pCash] = dini_Int(Login_String, "Cash");
  3218. Player_Infos[id][pBank] = dini_Int(Login_String, "Bank");
  3219. Player_Infos[id][pAdministrator] = dini_Int(Login_String, "Administrator");
  3220. Player_Infos[id][pModerator] = dini_Int(Login_String, "Moderator");
  3221. Player_Infos[id][pDonator] = dini_Int(Login_String, "Donator");
  3222. Player_Infos[id][pFaction] = dini_Int(Login_String, "Faction");
  3223. Player_Infos[id][pFaction_Rank] = dini_Int(Login_String, "Faction_Rank");
  3224. Player_Infos[id][pCK] = dini_Int(Login_String, "CK");
  3225. Player_Infos[id][pKills] = dini_Int(Login_String, "Kills");
  3226. Player_Infos[id][pDeaths] = dini_Int(Login_String, "Deaths");
  3227. Player_Infos[id][pTutorial] = dini_Int(Login_String, "Tutorial");
  3228. Player_Infos[id][pFines] = dini_Int(Login_String, "Fines");
  3229. Player_Infos[id][pVehicle_1_Key] = dini_Int(Login_String, "Vehicle_1_Key");
  3230. Player_Infos[id][pVehicle_1_Color_1] = dini_Int(Login_String, "Vehicle_1_Color_1");
  3231. Player_Infos[id][pVehicle_1_Color_2] = dini_Int(Login_String, "Vehicle_1_Color_2");
  3232. Player_Infos[id][pVehicle_1_Panel_Status] = dini_Int(Login_String, "Vehicle_1_Panel_Status");
  3233. Player_Infos[id][pVehicle_1_Doors_Status] = dini_Int(Login_String, "Vehicle_1_Doors_Status");
  3234. Player_Infos[id][pVehicle_1_Lights_Status] = dini_Int(Login_String, "Vehicle_1_Lights_Status");
  3235. Player_Infos[id][pVehicle_1_Tires_Status] = dini_Int(Login_String, "Vehicle_1_Tires_Status");
  3236. Player_Infos[id][pVehicle_1_Health] = dini_Float(Login_String, "Vehicle_1_Health");
  3237. Player_Infos[id][pVehicle_1_Plate] = dini_Int(Login_String, "Vehicle_1_Plate");
  3238. Player_Infos[id][pVehicle_1_Fuel] = dini_Int(Login_String, "Vehicle_1_Fuel");
  3239. Player_Infos[id][pVehicle_2_Key] = dini_Int(Login_String, "Vehicle_2_Key");
  3240. Player_Infos[id][pVehicle_2_Color_1] = dini_Int(Login_String, "Vehicle_2_Color_1");
  3241. Player_Infos[id][pVehicle_2_Color_2] = dini_Int(Login_String, "Vehicle_2_Color_2");
  3242. Player_Infos[id][pVehicle_2_Panel_Status] = dini_Int(Login_String, "Vehicle_2_Panel_Status");
  3243. Player_Infos[id][pVehicle_2_Doors_Status] = dini_Int(Login_String, "Vehicle_2_Doors_Status");
  3244. Player_Infos[id][pVehicle_2_Lights_Status] = dini_Int(Login_String, "Vehicle_2_Lights_Status");
  3245. Player_Infos[id][pVehicle_2_Tires_Status] = dini_Int(Login_String, "Vehicle_2_Tires_Status");
  3246. Player_Infos[id][pVehicle_2_Health] = dini_Float(Login_String, "Vehicle_2_Health");
  3247. Player_Infos[id][pVehicle_2_Plate] = dini_Int(Login_String, "Vehicle_2_Plate");
  3248. Player_Infos[id][pVehicle_2_Fuel] = dini_Int(Login_String, "Vehicle_2_Fuel");
  3249. Player_Infos[id][pVehicle_3_Key] = dini_Int(Login_String, "Vehicle_3_Key");
  3250. Player_Infos[id][pVehicle_3_Color_1] = dini_Int(Login_String, "Vehicle_3_Color_1");
  3251. Player_Infos[id][pVehicle_3_Color_2] = dini_Int(Login_String, "Vehicle_3_Color_2");
  3252. Player_Infos[id][pVehicle_3_Panel_Status] = dini_Int(Login_String, "Vehicle_3_Panel_Status");
  3253. Player_Infos[id][pVehicle_3_Doors_Status] = dini_Int(Login_String, "Vehicle_3_Doors_Status");
  3254. Player_Infos[id][pVehicle_3_Lights_Status] = dini_Int(Login_String, "Vehicle_3_Lights_Status");
  3255. Player_Infos[id][pVehicle_3_Tires_Status] = dini_Int(Login_String, "Vehicle_3_Tires_Status");
  3256. Player_Infos[id][pVehicle_3_Health] = dini_Float(Login_String, "Vehicle_3_Health");
  3257. Player_Infos[id][pVehicle_3_Plate] = dini_Int(Login_String, "Vehicle_3_Plate");
  3258. Player_Infos[id][pVehicle_3_Fuel] = dini_Int(Login_String, "Vehicle_3_Fuel");
  3259. Player_Infos[id][pPark_X] = dini_Int(Login_String, "Park_X");
  3260. Player_Infos[id][pPark_Y] = dini_Int(Login_String, "Park_Y");
  3261. Player_Infos[id][pPark_Z] = dini_Int(Login_String, "Park_Z");
  3262. Player_Infos[id][pPark_FA] = dini_Int(Login_String, "Park_FA");
  3263. Player_Infos[id][pCrash_X] = dini_Int(Login_String, "Crash_X");
  3264. Player_Infos[id][pCrash_Y] = dini_Int(Login_String, "Crash_Y");
  3265. Player_Infos[id][pCrash_Z] = dini_Int(Login_String, "Crash_Z");
  3266. Player_Infos[id][pCrash_F] = dini_Int(Login_String, "Crash_F");
  3267. Player_Infos[id][pCrashed] = dini_Int(Login_String, "Chrashed");
  3268. Player_Infos[id][pSpawn_X] = dini_Float(Login_String, "Spawn_X");
  3269. Player_Infos[id][pSpawn_Y] = dini_Float(Login_String, "Spawn_Y");
  3270. Player_Infos[id][pSpawn_Z] = dini_Float(Login_String, "Spawn_Z");
  3271. Player_Infos[id][pSkin] = dini_Int(Login_String, "Skin");
  3272. Player_Infos[id][pInterior] = dini_Int(Login_String, "Interior");
  3273. Player_Infos[id][pInObject] = -1;
  3274. Player_Infos[id][pObjectEnterX] = dini_Float(Login_String, "ObjectEnterX");
  3275. Player_Infos[id][pObjectEnterY] = dini_Float(Login_String, "ObjectEnterY");
  3276. Player_Infos[id][pObjectEnterZ] = dini_Float(Login_String, "ObjectEnterZ");
  3277. Player_Infos[id][pObjectInterior] = dini_Int(Login_String, "ObjectInterior");
  3278. Player_Infos[id][pSpawned_Vehicle] = -1;
  3279. Player_Infos[id][pHouse_Key] = 999;
  3280. for(new i = 0; i < MAX_HOUSES; i++){
  3281. if(strlen(HouseInfos[i][OwnerName]) >= 5){
  3282. if(strcmp(HouseInfos[i][OwnerName], Player_Infos[id][pName], true) == 0){
  3283. Player_Infos[id][pHouse_Key] = i;
  3284. print(HouseInfos[i][OwnerName]);
  3285. }
  3286. }
  3287. }
  3288. Player_Infos[id][pBiz_Key] = 999;
  3289. for(new bi = 0; bi < MAX_BUSINESS; bi++){
  3290. if(strlen(Business_Infos[bi][bizOwner_Name]) >= 5){
  3291. if(strcmp(Business_Infos[bi][bizOwner_Name], Player_Infos[id][pName], true) == 0){
  3292. Player_Infos[id][pBiz_Key] = bi;
  3293. print(Business_Infos[bi][bizOwner_Name]);
  3294. }
  3295. }
  3296. }
  3297. Player_Infos[id][pWeed] = dini_Int(Login_String, "Weed");
  3298. Player_Infos[id][pCoke] = dini_Int(Login_String, "Coke");
  3299. Player_Infos[id][pLSD] = dini_Int(Login_String, "LSD");
  3300. Player_Infos[id][pJob] = dini_Int(Login_String, "Job");
  3301. Player_Infos[id][pWeapon_1] = dini_Int(Login_String, "Weapon_1");
  3302. Player_Infos[id][pWeapon_1_Ammo] = dini_Int(Login_String, "Weapon_1_Ammo");
  3303. Player_Infos[id][pWeapon_2] = dini_Int(Login_String, "Weapon_2");
  3304. Player_Infos[id][pWeapon_2_Ammo] = dini_Int(Login_String, "Weapon_2_Ammo");
  3305. Player_Infos[id][pWeapon_3] = dini_Int(Login_String, "Weapon_3");
  3306. Player_Infos[id][pWeapon_3_Ammo] = dini_Int(Login_String, "Weapon_3_Ammo");
  3307. Player_Infos[id][pWeapon_4] = dini_Int(Login_String, "Weapon_4");
  3308. Player_Infos[id][pWeapon_4_Ammo] = dini_Int(Login_String, "Weapon_4_Ammo");
  3309. Player_Infos[id][pWeapon_5] = dini_Int(Login_String, "Weapon_5");
  3310. Player_Infos[id][pWeapon_5_Ammo] = dini_Int(Login_String, "Weapon_5_Ammo");
  3311. Player_Infos[id][pWeapon_6] = dini_Int(Login_String, "Weapon_6");
  3312. Player_Infos[id][pWeapon_6_Ammo] = dini_Int(Login_String, "Weapon_6_Ammo");
  3313. Player_Infos[id][pWeapon_7] = dini_Int(Login_String, "Weapon_7");
  3314. Player_Infos[id][pWeapon_7_Ammo] = dini_Int(Login_String, "Weapon_7_Ammo");
  3315. Player_Infos[id][pWeapon_8] = dini_Int(Login_String, "Weapon_8");
  3316. Player_Infos[id][pWeapon_8_Ammo] = dini_Int(Login_String, "Weapon_8_Ammo");
  3317. Player_Infos[id][pWeapon_9] = dini_Int(Login_String, "Weapon_9");
  3318. Player_Infos[id][pWeapon_9_Ammo] = dini_Int(Login_String, "Weapon_9_Ammo");
  3319. Player_Infos[id][pWeapon_10] = dini_Int(Login_String, "Weapon_10");
  3320. Player_Infos[id][pWeapon_10_Ammo] = dini_Int(Login_String, "Weapon_10_Ammo");
  3321. Player_Infos[id][pWeapon_11] = dini_Int(Login_String, "Weapon_11");
  3322. Player_Infos[id][pWeapon_11_Ammo] = dini_Int(Login_String, "Weapon_11_Ammo");
  3323. Player_Infos[id][pWeapon_12] = dini_Int(Login_String, "Weapon_12");
  3324. Player_Infos[id][pWeapon_12_Ammo] = dini_Int(Login_String, "Weapon_12_Ammo");
  3325. Player_Infos[id][pWeapon_13] = dini_Int(Login_String, "Weapon_13");
  3326. Player_Infos[id][pWeapon_13_Ammo] = dini_Int(Login_String, "Weapon_13_Ammo");
  3327. Player_Infos[id][pMobile_Num] = dini_Int(Login_String, "Mobile_Num");
  3328. Player_Infos[id][pMobile_Tog] = dini_Int(Login_String, "Mobile_Tog");
  3329. PlayerLogedIn[id] = 1;
  3330. SetSpawnInfo(id, 0, Player_Infos[id][pSkin], Player_Infos[id][pSpawn_X], Player_Infos[id][pSpawn_Y], Player_Infos[id][pSpawn_Z], 0.0, 0, 0, 0, 0, 0, 0);
  3331. SpawnPlayer(id);
  3332. return 1;
  3333. }
  3334. public RegisterPlayer(playerid, const password[]){
  3335. new Register_Player_Name[128], Register_String[128], PassNew[128];
  3336. GetPlayerName(playerid, Register_Player_Name, sizeof(Register_Player_Name));
  3337. format(Register_String, sizeof(Register_String), "Players/%s.ini", Register_Player_Name);
  3338. format(PassNew, 128, "%s", password);
  3339. dini_Create(Register_String);
  3340. dini_IntSet(Register_String, "Key", udb_hash(PassNew));
  3341. dini_IntSet(Register_String, "Level", 1);
  3342. dini_IntSet(Register_String, "Cash", 5000);
  3343. dini_IntSet(Register_String, "Bank", 15000);
  3344. dini_IntSet(Register_String, "Skin", 0);
  3345. dini_IntSet(Register_String, "Administrator", 0);
  3346. dini_IntSet(Register_String, "Moderator", 0);
  3347. dini_IntSet(Register_String, "Donator", 0);
  3348. dini_IntSet(Register_String, "Faction", 255);
  3349. dini_IntSet(Register_String, "Faction_Rank", 0);
  3350. dini_IntSet(Register_String, "CK", 0);
  3351. dini_IntSet(Register_String, "Tutorial", 999);
  3352. dini_IntSet(Register_String, "Fines", 0);
  3353. dini_IntSet(Register_String, "Kills", 0);
  3354. dini_IntSet(Register_String, "Deaths", 0);
  3355. dini_IntSet(Register_String, "Vehicle_1_Key", 999);
  3356. dini_IntSet(Register_String, "Vehicle_1_Color_1", 0);
  3357. dini_IntSet(Register_String, "Vehicle_1_Color_2", 0);
  3358. dini_IntSet(Register_String, "Vehicle_1_Panel_Status", 0);
  3359. dini_IntSet(Register_String, "Vehicle_1_Doors_Status", 0);
  3360. dini_IntSet(Register_String, "Vehicle_1_Lights_Status", 0);
  3361. dini_IntSet(Register_String, "Vehicle_1_Tires_Status", 0);
  3362. dini_FloatSet(Register_String, "Vehicle_1_Health", 1000.0);
  3363. dini_IntSet(Register_String, "Vehicle_1_Plate", 0);
  3364. dini_IntSet(Register_String, "Vehicle_1_Fuel", 0);
  3365. dini_IntSet(Register_String, "Vehicle_2_Key", 999);
  3366. dini_IntSet(Register_String, "Vehicle_2_Color_1", 0);
  3367. dini_IntSet(Register_String, "Vehicle_2_Color_2", 0);
  3368. dini_IntSet(Register_String, "Vehicle_2_Panel_Status", 0);
  3369. dini_IntSet(Register_String, "Vehicle_2_Doors_Status", 0);
  3370. dini_IntSet(Register_String, "Vehicle_2_Lights_Status", 0);
  3371. dini_IntSet(Register_String, "Vehicle_2_Tires_Status", 0);
  3372. dini_FloatSet(Register_String, "Vehicle_2_Health", 1000.0);
  3373. dini_IntSet(Register_String, "Vehicle_2_Plate", 0);
  3374. dini_IntSet(Register_String, "Vehicle_2_Fuel", 0);
  3375. dini_IntSet(Register_String, "Vehicle_3_Key", 999);
  3376. dini_IntSet(Register_String, "Vehicle_3_Color_1", 0);
  3377. dini_IntSet(Register_String, "Vehicle_3_Color_2", 0);
  3378. dini_IntSet(Register_String, "Vehicle_3_Panel_Status", 0);
  3379. dini_IntSet(Register_String, "Vehicle_3_Doors_Status", 0);
  3380. dini_IntSet(Register_String, "Vehicle_3_Lights_Status", 0);
  3381. dini_IntSet(Register_String, "Vehicle_3_Tires_Status", 0);
  3382. dini_FloatSet(Register_String, "Vehicle_3_Health", 1000.0);
  3383. dini_IntSet(Register_String, "Vehicle_3_Plate", 0);
  3384. dini_IntSet(Register_String, "Vehicle_3_Fuel", 0);
  3385. dini_FloatSet(Register_String, "Park_X", 0.0);
  3386. dini_FloatSet(Register_String, "Park_Y", 0.0);
  3387. dini_FloatSet(Register_String, "Park_Z", 0.0);
  3388. dini_FloatSet(Register_String, "Park_FA", 0.0);
  3389. dini_FloatSet(Register_String, "Crash_X", 0.0);
  3390. dini_FloatSet(Register_String, "Crash_Y", 0.0);
  3391. dini_FloatSet(Register_String, "Crash_Z", 0.0);
  3392. dini_FloatSet(Register_String, "Crash_F", 0.0);
  3393. dini_IntSet(Register_String, "Crashed", 0);
  3394. dini_FloatSet(Register_String, "Spawn_X", 1454.9869606623206);
  3395. dini_FloatSet(Register_String, "Spawn_Y", -2344.1601259480267);
  3396. dini_FloatSet(Register_String, "Spawn_Z", 10.0);
  3397. dini_IntSet(Register_String, "Interior", 0);
  3398. dini_IntSet(Register_String, "InObject", -1);
  3399. dini_FloatSet(Register_String, "ObjectEnterX", 0.0);
  3400. dini_FloatSet(Register_String, "ObjectEnterY", 0.0);
  3401. dini_FloatSet(Register_String, "ObjectEnterZ", 0.0);
  3402. dini_IntSet(Register_String, "ObjectInterior", 0);
  3403. dini_IntSet(Register_String, "ObjectType", 0);
  3404. dini_IntSet(Register_String, "Weed", 0);
  3405. dini_IntSet(Register_String, "Coke", 0);
  3406. dini_IntSet(Register_String, "LSD", 0);
  3407. dini_IntSet(Register_String, "Job", 255);
  3408. dini_IntSet(Register_String, "Weapon_1", 999);
  3409. dini_IntSet(Register_String, "Weapon_1_Ammo", 0);
  3410. dini_IntSet(Register_String, "Weapon_2", 999);
  3411. dini_IntSet(Register_String, "Weapon_2_Ammo", 0);
  3412. dini_IntSet(Register_String, "Weapon_3", 999);
  3413. dini_IntSet(Register_String, "Weapon_3_Ammo", 0);
  3414. dini_IntSet(Register_String, "Weapon_4", 999);
  3415. dini_IntSet(Register_String, "Weapon_4_Ammo", 0);
  3416. dini_IntSet(Register_String, "Weapon_5", 999);
  3417. dini_IntSet(Register_String, "Weapon_5_Ammo", 0);
  3418. dini_IntSet(Register_String, "Weapon_6", 999);
  3419. dini_IntSet(Register_String, "Weapon_6_Ammo", 0);
  3420. dini_IntSet(Register_String, "Weapon_7", 999);
  3421. dini_IntSet(Register_String, "Weapon_7_Ammo", 0);
  3422. dini_IntSet(Register_String, "Weapon_8", 999);
  3423. dini_IntSet(Register_String, "Weapon_8_Ammo", 0);
  3424. dini_IntSet(Register_String, "Weapon_9", 999);
  3425. dini_IntSet(Register_String, "Weapon_9_Ammo", 0);
  3426. dini_IntSet(Register_String, "Weapon_10", 999);
  3427. dini_IntSet(Register_String, "Weapon_10_Ammo", 0);
  3428. dini_IntSet(Register_String, "Weapon_11", 999);
  3429. dini_IntSet(Register_String, "Weapon_11_Ammo", 0);
  3430. dini_IntSet(Register_String, "Weapon_12", 999);
  3431. dini_IntSet(Register_String, "Weapon_12_Ammo", 0);
  3432. dini_IntSet(Register_String, "Weapon_13", 999);
  3433. dini_IntSet(Register_String, "Weapon_13_Ammo", 0);
  3434. dini_IntSet(Register_String, "Mobile_Num", 0);
  3435. dini_IntSet(Register_String, "Mobile_Tog", 0);
  3436. SendClientMessage(playerid, COLOR_YELLOW, "You have register your account. Please login now");
  3437. ShowPlayerDialog(playerid, 1, 1, "Login", "You have register your account.\n\r Please login:", "Login", "Close");
  3438. return 1;
  3439. }
  3440. stock SendToNearPlayers(playerid, color1, color2, color3, color4, color5, Float:stnp_radius, const stnp_text[]){
  3441. new Float:PosX, Float:PosY, Float:PosZ;
  3442. GetPlayerPos(playerid, PosX, PosY, PosZ);
  3443. for(new i = 0; i < MAX_PLAYERS; i++){
  3444. if(IsPlayerConnected(i)){
  3445. if(IsPlayerInRangeOfPoint(i, stnp_radius / 5, PosX, PosY, PosZ)){
  3446. SendClientMessage(i, color1, stnp_text);
  3447. }else if(IsPlayerInRangeOfPoint(i, stnp_radius / 4, PosX, PosY, PosZ)){
  3448. SendClientMessage(i, color2, stnp_text);
  3449. }else if(IsPlayerInRangeOfPoint(i, stnp_radius / 3, PosX, PosY, PosZ)){
  3450. SendClientMessage(i, color3, stnp_text);
  3451. }else if(IsPlayerInRangeOfPoint(i, stnp_radius / 2, PosX, PosY, PosZ)){
  3452. SendClientMessage(i, color4, stnp_text);
  3453. }else if(IsPlayerInRangeOfPoint(i, stnp_radius, PosX, PosY, PosZ)){
  3454. SendClientMessage(i, color5, stnp_text);
  3455. }
  3456. }
  3457. }
  3458. return 1;
  3459. }
  3460. public TutorialStep1(playerid){
  3461. new WelcomeText[128];
  3462. ClearChat(playerid);
  3463. Doing_Tutorial[playerid] = 1;
  3464. TogglePlayerControllable(playerid, 0);
  3465. SetPlayerVirtualWorld(playerid, playerid+1);
  3466. SetPlayerPos(playerid, 1461.10,-1602.13,47.0);
  3467. SetPlayerCameraPos(playerid, 1461.10,-1602.13,53.47);
  3468. SetPlayerCameraLookAt(playerid, 1542.307861,-1673.120483,13.554246);
  3469. format(WelcomeText, sizeof(WelcomeText), "Welcome to %s", SERVERNAME);
  3470. SendClientMessage(playerid, COLOR_YELLOW, WelcomeText);
  3471. SendClientMessage(playerid, COLOR_YELLOW, "As this is an Roleplay server, administrators belives that you are goint to follow the rules.");
  3472. SendClientMessage(playerid, COLOR_YELLOW, "Cheating or Hacking is not allowed, if you see someone cheat or hack, report him (/report) to administrators.");
  3473. SendClientMessage(playerid, COLOR_YELLOW, "As you know this is roleplay server, so DeathMatching, Metagaming, Powergaming, BunnyHoping is not allowed ");
  3474. SendClientMessage(playerid, COLOR_YELLOW, "If you get caught while DM, MG, PG or BH, you will be warned, 3 warnings and you'll get 10minutes ban.");
  3475. SetTimerEx("TutorialStep2", 15000, false, "d", playerid);
  3476. }
  3477. public TutorialStep2(playerid){
  3478. ClearChat(playerid);
  3479. SetPlayerPos(playerid, 2075.08, -1948.62, 23.79);
  3480. SetPlayerCameraPos(playerid, 2075.08, -1948.62, 28.79);
  3481. SetPlayerCameraLookAt(playerid, 2056.000000,-1911.500000,13.546875);
  3482. SendClientMessage(playerid, COLOR_YELLOW, "You are new around here, so you'll need to pass the driving test");
  3483. SendClientMessage(playerid, COLOR_YELLOW, "If you get caught without driving license, you'll be fined.");
  3484. SendClientMessage(playerid, COLOR_YELLOW, "Here as in real world, you must obey the law, and drive on right side of the road");
  3485. SetTimerEx("TutorialStep3", 10000, false, "d", playerid);
  3486. }
  3487. public TutorialStep3(playerid){
  3488. ClearChat(playerid);
  3489. SetPlayerPos(playerid, 2067.39, -1794.29, 23.31);
  3490. SetPlayerCameraPos(playerid, 2067.39, -1794.29, 28.31);
  3491. SetPlayerCameraLookAt(playerid, 2099.833251,-1806.851684,13.554687);
  3492. SendClientMessage(playerid, COLOR_YELLOW, "If your hp is low, visit Pizza Stack, Burger Shot or Cluckin Bell.");
  3493. SendClientMessage(playerid, COLOR_YELLOW, "Enter inside to buy some food that will regenerate your hp.");
  3494. SendClientMessage(playerid, COLOR_YELLOW, "Be sure you have enought money before you enter some of these Food shops.");
  3495. SetTimerEx("TutorialStep4", 10000, false, "d", playerid);
  3496. }
  3497. public TutorialStep4(playerid){
  3498. ClearChat(playerid);
  3499. SetPlayerPos(playerid, 1221.62, -1325.04, 15.65);
  3500. SetPlayerCameraPos(playerid, 1221.62, -1325.04, 20.65);
  3501. SetPlayerCameraLookAt(playerid, 1177.756103,-1323.031494,14.086398);
  3502. SendClientMessage(playerid, COLOR_YELLOW, "After you die, you will be spawned at nearest hostpital.");
  3503. SendClientMessage(playerid, COLOR_YELLOW, "If you dont have life insurance you will pay the doctor your healing");
  3504. SendClientMessage(playerid, COLOR_YELLOW, "Also if you feel sick, visit hostpital to help you.");
  3505. SetTimerEx("TutorialStep5", 10000, false, "d", playerid);
  3506. }
  3507. public TutorialStep5(playerid){
  3508. ClearChat(playerid);
  3509. SetPlayerPos(playerid, 1942.34, -1053.28, 150.19);
  3510. SetPlayerCameraPos(playerid, 1942.34, -1053.28, 156.19);
  3511. SetPlayerCameraLookAt(playerid, 1967.875976,-1189.621093,25.771028);
  3512. SendClientMessage(playerid, COLOR_YELLOW, "Thats it, if you need any help, just type /help, or contact administrator.");
  3513. SendClientMessage(playerid, COLOR_YELLOW, "Have a nice day in GTA SAMP.");
  3514. SetTimerEx("TutorialFinish", 7000, false, "d", playerid);
  3515. }
  3516. public TutorialFinish(playerid){
  3517. Doing_Tutorial[playerid] = 0;
  3518. SetPlayerVirtualWorld(playerid, 0);
  3519. TogglePlayerControllable(playerid, 1);
  3520. Player_Infos[playerid][pTutorial] = 0;
  3521. SpawnPlayer(playerid);
  3522. }
  3523. stock ClearChat(playerid){
  3524. for(new i = 0; i < 200; i++){
  3525. SendClientMessage(playerid, COLOR_WHITE, " ");
  3526. }
  3527. return 1;
  3528. }
  3529. stock GetPlayerIDByName(const Name[], &playerid){
  3530. new Player_Name_For_ID[64];
  3531. playerid = -1;
  3532. for(new i = 0; i < MAX_PLAYERS; i++){
  3533. GetPlayerName(i, Player_Name_For_ID, sizeof(Player_Name_For_ID));
  3534. if(strcmp(Player_Name_For_ID, Name, true) == 0){
  3535. playerid = i;
  3536. return 1;
  3537. }
  3538. }
  3539. return 1;
  3540. }
  3541. stock split(const strsrc[], strdest[][], delimiter)
  3542. {
  3543. new i, li;
  3544. new aNum;
  3545. new len;
  3546. while(i <= strlen(strsrc))
  3547. {
  3548. if(strsrc[i] == delimiter || i == strlen(strsrc))
  3549. {
  3550. len = strmid(strdest[aNum], strsrc, li, i, 128);
  3551. strdest[aNum][len] = 0;
  3552. li = i+1;
  3553. aNum++;
  3554. }
  3555. i++;
  3556. }
  3557. return 1;
  3558. }
  3559. stock udb_hash(buf[]) {
  3560. new length=strlen(buf);
  3561. new s1 = 1;
  3562. new s2 = 0;
  3563. new n;
  3564. for (n=0; n<length; n++)
  3565. {
  3566. s1 = (s1 + buf[n]) % 65521;
  3567. s2 = (s2 + s1) % 65521;
  3568. }
  3569. return (s2 << 16) + s1;
  3570. }
  3571. stock strtok(const string[], &index){
  3572. new length = strlen(string);
  3573. while ((index < length) && (string[index] <= ' ')) {
  3574. index++;
  3575. }
  3576. new offset = index;
  3577. new result[20];
  3578. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) {
  3579. result[index - offset] = string[index];
  3580. index++;
  3581. }
  3582. result[index - offset] = EOS;
  3583. return result;
  3584. }
  3585. stock strrest(const string[], &index)
  3586. {
  3587. new length = strlen(string);
  3588. while ((index < length) && (string[index] <= ' '))
  3589. {
  3590. index++;
  3591. }
  3592. new offset = index;
  3593. new result[128];
  3594. while ((index < length) && ((index - offset) < (sizeof(result) - 1)))
  3595. {
  3596. result[index - offset] = string[index];
  3597. index++;
  3598. }
  3599. result[index - offset] = EOS;
  3600. return result;
  3601. }
  3602. stock GivePlayerCash(playerid, money)
  3603. {
  3604. Player_Infos[playerid][pCash] += money;
  3605. ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
  3606. UpdateMoneyBar(playerid,Player_Infos[playerid][pCash]);//Sets the money in the moneybar to the serverside cash, Do not remove!
  3607. return Player_Infos[playerid][pCash];
  3608. }
  3609. stock SetPlayerCash(playerid, money)
  3610. {
  3611. Player_Infos[playerid][pCash] = money;
  3612. ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
  3613. UpdateMoneyBar(playerid,Player_Infos[playerid][pCash]);//Sets the money in the moneybar to the serverside cash, Do not remove!
  3614. return Player_Infos[playerid][pCash];
  3615. }
  3616. stock ResetPlayerCash(playerid)
  3617. {
  3618. Player_Infos[playerid][pCash] = 0;
  3619. ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
  3620. UpdateMoneyBar(playerid,Player_Infos[playerid][pCash]);//Sets the money in the moneybar to the serverside cash, Do not remove!
  3621. return Player_Infos[playerid][pCash];
  3622. }
  3623. stock GetPlayerCash(playerid)
  3624. {
  3625. return Player_Infos[playerid][pCash];
  3626. }
  3627. public SwitchEngineOn(playerid, vehicleid){
  3628. new rand = random(15);
  3629. if(rand == 1){
  3630. GameTextForPlayer(playerid, "~r~Engine was not started", 3000, 6);
  3631. return 1;
  3632. }
  3633. GameTextForPlayer(playerid, "~g~Engine started", 3000, 6);
  3634. ToggleVehicleEngine(vehicleid, 1);
  3635. return 1;
  3636. }
  3637. public ToggleVehicleEngine(vehicleid, toggle){
  3638. new engine, lights, alarm, doors,bonnet,boot,objective;
  3639. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors,bonnet,boot,objective);
  3640. SetVehicleParamsEx(vehicleid, toggle, lights, alarm, doors,bonnet,boot,objective);
  3641. return 1;
  3642. }
  3643. stock ToggleVehicleLights(vehicleid, toggle){
  3644. new engine, lights, alarm, doors,bonnet,boot,objective;
  3645. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors,bonnet,boot,objective);
  3646. SetVehicleParamsEx(vehicleid, engine, toggle, alarm, doors,bonnet,boot,objective);
  3647. return 1;
  3648. }
  3649. stock GetEngineStatus(vehicleid){
  3650. new engine, lights, alarm, doors,bonnet,boot,objective;
  3651. GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors,bonnet,boot,objective);
  3652. return engine;
  3653. }
  3654. public Add247(playerid, interior){
  3655. new File:Add247File = fopen("247.txt", io_append);
  3656. new Float:X, Float:Y, Float:Z, Add247String[256];
  3657. new Float:IntX, Float:IntY, Float:IntZ, Int;
  3658. GetPlayerPos(playerid, X, Y, Z);
  3659. switch(interior){
  3660. case 1:{
  3661. IntX = -25.884498;
  3662. IntY = -185.868988;
  3663. IntZ = 1003.546875;
  3664. Int = 17;
  3665. }
  3666. case 2:{
  3667. IntX= 6.091179;
  3668. IntY = -29.271898;
  3669. IntZ = 1003.549438;
  3670. Int = 10;
  3671. }
  3672. case 3:{
  3673. IntX = -30.946699;
  3674. IntY = -89.609596;
  3675. IntZ = 1003.546875;
  3676. Int = 18;
  3677. }
  3678. case 4:{
  3679. IntX = -25.132598;
  3680. IntY = -139.066986;
  3681. IntZ = 1003.546875;
  3682. Int = 16;
  3683. }
  3684. case 5:{
  3685. IntX = -27.312299;
  3686. IntY = -29.277599;
  3687. IntZ = 1003.557250;
  3688. Int = 4;
  3689. }
  3690. case 6:{
  3691. IntX = -26.691598;
  3692. IntY = -55.714897;
  3693. IntZ = 1003.546875;
  3694. Int = 6;
  3695. }
  3696. default:{
  3697. IntX = -26.691598;
  3698. IntY = -55.714897;
  3699. IntZ = 1003.546875;
  3700. Int = 6;
  3701. }
  3702. }
  3703. format(Add247String, sizeof(Add247String), "%f,%f,%f,%f,%f,%f,%d", X, Y, Z, IntX, IntY, IntZ, Int);
  3704. fwrite(Add247File, Add247String);
  3705. fclose(Add247File);
  3706. return 1;
  3707. }
  3708. public Load247(){
  3709. print("Loading 24/7");
  3710. new s247File[128], s247FileString[256], s247FileStringSplit[7][12];
  3711. format(s247File, sizeof(s247File), "247.txt");
  3712. if(!dini_Exists(s247File)){
  3713. return 1;
  3714. }
  3715. new File:FileRead = fopen(s247File, io_read);
  3716. new s247_ID = 0;
  3717. while(fread(FileRead, s247FileString)){
  3718. split(s247FileString, s247FileStringSplit, ',');
  3719. Stores_Infos[s247_ID][sEnter_X] = floatstr(s247FileStringSplit[0]);
  3720. Stores_Infos[s247_ID][sEnter_Y] = floatstr(s247FileStringSplit[1]);
  3721. Stores_Infos[s247_ID][sEnter_Z] = floatstr(s247FileStringSplit[2]);
  3722. Stores_Infos[s247_ID][sInt_X] = floatstr(s247FileStringSplit[3]);
  3723. Stores_Infos[s247_ID][sInt_Y] = floatstr(s247FileStringSplit[4]);
  3724. Stores_Infos[s247_ID][sInt_Z] = floatstr(s247FileStringSplit[5]);
  3725. Stores_Infos[s247_ID][sInt] = strval(s247FileStringSplit[6]);
  3726. Create3DTextLabel("24/7 Store", COLOR_YELLOW, Stores_Infos[s247_ID][sEnter_X], Stores_Infos[s247_ID][sEnter_Y], Stores_Infos[s247_ID][sEnter_Z],20,0);
  3727. CreatePickupEx(1239, 1 , Stores_Infos[s247_ID][sEnter_X], Stores_Infos[s247_ID][sEnter_Y], Stores_Infos[s247_ID][sEnter_Z], 0);
  3728. s247_ID++;
  3729. }
  3730. fclose(FileRead);
  3731. return 1;
  3732. }
  3733. public CreatePickupEx(pickup_model, pickup_type, Float:pickup_X, Float:pickup_Y, Float:pickup_Z, pickup_virtualworld){
  3734. new CreatedPickup;
  3735. CreatedPickup = CreatePickup(pickup_model, pickup_type, pickup_X, pickup_Y, pickup_Z, pickup_virtualworld);
  3736. PickUps[CreatedPickup][puModel] = pickup_model;
  3737. PickUps[CreatedPickup][puType] = pickup_type;
  3738. PickUps[CreatedPickup][puX] = pickup_X;
  3739. PickUps[CreatedPickup][puY] = pickup_Y;
  3740. PickUps[CreatedPickup][puZ] = pickup_Z;
  3741. PickUps[CreatedPickup][puVirtualWorld] = pickup_virtualworld;
  3742. return CreatedPickup;
  3743. }
  3744. public GetPickupModel(pickupid){
  3745. return PickUps[pickupid][puModel];
  3746. }
  3747. public SaveAccount(const Player_Name[], crashed){
  3748. new Save_Account_File[128], playerid;
  3749. GetPlayerIDByName(Player_Name, playerid);
  3750. format(Save_Account_File, sizeof(Save_Account_File), "Players/%s.ini", Player_Name);
  3751. if(!dini_Exists(Save_Account_File)){
  3752. return 1;
  3753. }
  3754. dini_IntSet(Save_Account_File, "Level", Player_Infos[playerid][pLevel]);
  3755. dini_IntSet(Save_Account_File, "Cash", Player_Infos[playerid][pCash]);
  3756. dini_IntSet(Save_Account_File, "Bank", Player_Infos[playerid][pBank]);
  3757. dini_IntSet(Save_Account_File, "Skin", Player_Infos[playerid][pSkin]);
  3758. dini_IntSet(Save_Account_File, "Administrator", Player_Infos[playerid][pAdministrator]);
  3759. dini_IntSet(Save_Account_File, "Moderator", Player_Infos[playerid][pModerator]);
  3760. dini_IntSet(Save_Account_File, "Donator", Player_Infos[playerid][pDonator]);
  3761. dini_IntSet(Save_Account_File, "Faction", Player_Infos[playerid][pFaction]);
  3762. dini_IntSet(Save_Account_File, "Faction_Rank", Player_Infos[playerid][pFaction]);
  3763. dini_IntSet(Save_Account_File, "CK", Player_Infos[playerid][pCK]);
  3764. dini_IntSet(Save_Account_File, "Tutorial", Player_Infos[playerid][pTutorial]);
  3765. dini_IntSet(Save_Account_File, "Fines", Player_Infos[playerid][pFines]);
  3766. dini_IntSet(Save_Account_File, "Kills", Player_Infos[playerid][pKills]);
  3767. dini_IntSet(Save_Account_File, "Deaths", Player_Infos[playerid][pDeaths]);
  3768. dini_IntSet(Save_Account_File, "Vehicle_1_Key", Player_Infos[playerid][pVehicle_1_Key]);
  3769. dini_IntSet(Save_Account_File, "Vehicle_1_Color_1", Player_Infos[playerid][pVehicle_1_Color_1]);
  3770. dini_IntSet(Save_Account_File, "Vehicle_1_Color_2", Player_Infos[playerid][pVehicle_1_Color_2]);
  3771. dini_IntSet(Save_Account_File, "Vehicle_1_Panel_Status", Player_Infos[playerid][pVehicle_1_Panel_Status]);
  3772. dini_IntSet(Save_Account_File, "Vehicle_1_Doors_Status", Player_Infos[playerid][pVehicle_1_Doors_Status]);
  3773. dini_IntSet(Save_Account_File, "Vehicle_1_Lights_Status", Player_Infos[playerid][pVehicle_1_Lights_Status]);
  3774. dini_IntSet(Save_Account_File, "Vehicle_1_Tires_Status", Player_Infos[playerid][pVehicle_1_Tires_Status]);
  3775. dini_FloatSet(Save_Account_File, "Vehicle_1_Health", Player_Infos[playerid][pVehicle_1_Health]);
  3776. dini_IntSet(Save_Account_File, "Vehicle_1_Plate", Player_Infos[playerid][pVehicle_1_Plate]);
  3777. dini_IntSet(Save_Account_File, "Vehicle_1_Fuel", Player_Infos[playerid][pVehicle_1_Fuel]);
  3778. dini_IntSet(Save_Account_File, "Vehicle_2_Key", Player_Infos[playerid][pVehicle_2_Key]);
  3779. dini_IntSet(Save_Account_File, "Vehicle_2_Color_1", Player_Infos[playerid][pVehicle_2_Color_1]);
  3780. dini_IntSet(Save_Account_File, "Vehicle_2_Color_2", Player_Infos[playerid][pVehicle_2_Color_2]);
  3781. dini_IntSet(Save_Account_File, "Vehicle_2_Panel_Status", Player_Infos[playerid][pVehicle_2_Panel_Status]);
  3782. dini_IntSet(Save_Account_File, "Vehicle_2_Doors_Status", Player_Infos[playerid][pVehicle_2_Doors_Status]);
  3783. dini_IntSet(Save_Account_File, "Vehicle_2_Lights_Status", Player_Infos[playerid][pVehicle_2_Lights_Status]);
  3784. dini_IntSet(Save_Account_File, "Vehicle_2_Tires_Status", Player_Infos[playerid][pVehicle_2_Tires_Status]);
  3785. dini_FloatSet(Save_Account_File, "Vehicle_2_Health", Player_Infos[playerid][pVehicle_2_Health]);
  3786. dini_IntSet(Save_Account_File, "Vehicle_2_Plate", Player_Infos[playerid][pVehicle_2_Plate]);
  3787. dini_IntSet(Save_Account_File, "Vehicle_2_Fuel", Player_Infos[playerid][pVehicle_2_Fuel]);
  3788. dini_IntSet(Save_Account_File, "Vehicle_3_Key", Player_Infos[playerid][pVehicle_3_Key]);
  3789. dini_IntSet(Save_Account_File, "Vehicle_3_Color_1", Player_Infos[playerid][pVehicle_3_Color_1]);
  3790. dini_IntSet(Save_Account_File, "Vehicle_3_Color_2", Player_Infos[playerid][pVehicle_3_Color_2]);
  3791. dini_IntSet(Save_Account_File, "Vehicle_3_Panel_Status", Player_Infos[playerid][pVehicle_3_Panel_Status]);
  3792. dini_IntSet(Save_Account_File, "Vehicle_3_Doors_Status", Player_Infos[playerid][pVehicle_3_Doors_Status]);
  3793. dini_IntSet(Save_Account_File, "Vehicle_3_Lights_Status", Player_Infos[playerid][pVehicle_3_Lights_Status]);
  3794. dini_IntSet(Save_Account_File, "Vehicle_3_Tires_Status", Player_Infos[playerid][pVehicle_3_Tires_Status]);
  3795. dini_FloatSet(Save_Account_File, "Vehicle_3_Health", Player_Infos[playerid][pVehicle_3_Health]);
  3796. dini_IntSet(Save_Account_File, "Vehicle_3_Plate", Player_Infos[playerid][pVehicle_3_Plate]);
  3797. dini_IntSet(Save_Account_File, "Vehicle_3_Fuel", Player_Infos[playerid][pVehicle_3_Fuel]);
  3798. dini_FloatSet(Save_Account_File, "Park_X", Player_Infos[playerid][pPark_X]);
  3799. dini_FloatSet(Save_Account_File, "Park_Y", Player_Infos[playerid][pPark_Y]);
  3800. dini_FloatSet(Save_Account_File, "Park_Z", Player_Infos[playerid][pPark_Z]);
  3801. dini_FloatSet(Save_Account_File, "Park_FA", Player_Infos[playerid][pPark_FA]);
  3802. dini_FloatSet(Save_Account_File, "Spawn_X", Player_Infos[playerid][pSpawn_X]);
  3803. dini_FloatSet(Save_Account_File, "Spawn_Y", Player_Infos[playerid][pSpawn_Y]);
  3804. dini_FloatSet(Save_Account_File, "Spawn_Z", Player_Infos[playerid][pSpawn_Z]);
  3805. dini_IntSet(Save_Account_File, "Weed", Player_Infos[playerid][pWeed]);
  3806. dini_IntSet(Save_Account_File, "Coke", Player_Infos[playerid][pCoke]);
  3807. dini_IntSet(Save_Account_File, "LSD", Player_Infos[playerid][pLSD]);
  3808. dini_IntSet(Save_Account_File, "Job", Player_Infos[playerid][pJob]);
  3809. dini_IntSet(Save_Account_File, "Weapon_1", Player_Infos[playerid][pWeapon_1]);
  3810. dini_IntSet(Save_Account_File, "Weapon_1_Ammo", Player_Infos[playerid][pWeapon_1_Ammo]);
  3811. dini_IntSet(Save_Account_File, "Weapon_2", Player_Infos[playerid][pWeapon_2]);
  3812. dini_IntSet(Save_Account_File, "Weapon_2_Ammo", Player_Infos[playerid][pWeapon_2_Ammo]);
  3813. dini_IntSet(Save_Account_File, "Weapon_3", Player_Infos[playerid][pWeapon_3]);
  3814. dini_IntSet(Save_Account_File, "Weapon_3_Ammo", Player_Infos[playerid][pWeapon_3_Ammo]);
  3815. dini_IntSet(Save_Account_File, "Weapon_4", Player_Infos[playerid][pWeapon_4]);
  3816. dini_IntSet(Save_Account_File, "Weapon_4_Ammo", Player_Infos[playerid][pWeapon_4_Ammo]);
  3817. dini_IntSet(Save_Account_File, "Weapon_5", Player_Infos[playerid][pWeapon_5]);
  3818. dini_IntSet(Save_Account_File, "Weapon_5_Ammo", Player_Infos[playerid][pWeapon_5_Ammo]);
  3819. dini_IntSet(Save_Account_File, "Weapon_6", Player_Infos[playerid][pWeapon_6]);
  3820. dini_IntSet(Save_Account_File, "Weapon_6_Ammo", Player_Infos[playerid][pWeapon_6_Ammo]);
  3821. dini_IntSet(Save_Account_File, "Weapon_7", Player_Infos[playerid][pWeapon_7]);
  3822. dini_IntSet(Save_Account_File, "Weapon_7_Ammo", Player_Infos[playerid][pWeapon_7_Ammo]);
  3823. dini_IntSet(Save_Account_File, "Weapon_8", Player_Infos[playerid][pWeapon_8]);
  3824. dini_IntSet(Save_Account_File, "Weapon_8_Ammo", Player_Infos[playerid][pWeapon_8_Ammo]);
  3825. dini_IntSet(Save_Account_File, "Weapon_9", Player_Infos[playerid][pWeapon_9]);
  3826. dini_IntSet(Save_Account_File, "Weapon_9_Ammo", Player_Infos[playerid][pWeapon_9_Ammo]);
  3827. dini_IntSet(Save_Account_File, "Weapon_10", Player_Infos[playerid][pWeapon_10]);
  3828. dini_IntSet(Save_Account_File, "Weapon_10_Ammo", Player_Infos[playerid][pWeapon_10_Ammo]);
  3829. dini_IntSet(Save_Account_File, "Weapon_11", Player_Infos[playerid][pWeapon_11]);
  3830. dini_IntSet(Save_Account_File, "Weapon_11_Ammo", Player_Infos[playerid][pWeapon_11_Ammo]);
  3831. dini_IntSet(Save_Account_File, "Weapon_12", Player_Infos[playerid][pWeapon_12]);
  3832. dini_IntSet(Save_Account_File, "Weapon_12_Ammo", Player_Infos[playerid][pWeapon_12_Ammo]);
  3833. dini_IntSet(Save_Account_File, "Weapon_13", Player_Infos[playerid][pWeapon_13]);
  3834. dini_IntSet(Save_Account_File, "Weapon_13_Ammo", Player_Infos[playerid][pWeapon_13_Ammo]);
  3835. dini_IntSet(Save_Account_File, "Mobile_Num", Player_Infos[playerid][pMobile_Num]);
  3836. dini_IntSet(Save_Account_File, "Mobile_Tog", Player_Infos[playerid][pMobile_Tog]);
  3837. if(crashed == 1){
  3838. if(Player_Infos[playerid][pInObject] != -1){
  3839. dini_IntSet(Save_Account_File, "Interior", 0);
  3840. dini_FloatSet(Save_Account_File, "Crash_X", Player_Infos[playerid][pObjectEnterX]);
  3841. dini_FloatSet(Save_Account_File, "Crash_Y", Player_Infos[playerid][pObjectEnterY]);
  3842. dini_FloatSet(Save_Account_File, "Crash_Z", Player_Infos[playerid][pObjectEnterZ]);
  3843. dini_FloatSet(Save_Account_File, "Crash_F", 0.0);
  3844. }
  3845. dini_IntSet(Save_Account_File, "Crashed", 1);
  3846. }
  3847. return 1;
  3848. }
  3849. stock IsPlayerNearPlayer(playerid, n_playerid, Float:radius){
  3850. new Float:npx, Float:npy, Float:npz;
  3851. GetPlayerPos(n_playerid, npx, npy, npz);
  3852. if(IsPlayerInRangeOfPoint(playerid, radius, npx, npy, npz)){
  3853. return true;
  3854. }else{
  3855. return false;
  3856. }
  3857. }
  3858. stock ReloadHousesFile(){
  3859. fremove("houses.txt");
  3860. for(new i = 0; i < MAX_HOUSES; i++){
  3861. if(strlen(HouseInfos[i][HouseName]) >= 5){
  3862. CreateHouse(HouseInfos[i][HouseName], HouseInfos[i][OwnerName], HouseInfos[i][Price], HouseInfos[i][Locked], HouseInfos[i][OnSale], HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ], HouseInfos[i][HouseInteriorX], HouseInfos[i][HouseInteriorY], HouseInfos[i][HouseInteriorZ], HouseInfos[i][HouseInteriorID]);
  3863. }
  3864. }
  3865. return 1;
  3866. }
  3867.  
  3868. public AddJob(const Job_Name[], Job_Type, Float:Job_X, Float:Job_Y, Float:Job_Z){
  3869. new File:Job = fopen("jobs.txt", io_append);
  3870. new jbString[128];
  3871. format(jbString, sizeof(jbString), "%s,%d,%f,%f,%f\n", Job_Name, Job_Type, Job_X, Job_Y, Job_Z);
  3872. fwrite(Job, jbString);
  3873. fclose(Job);
  3874. return 1;
  3875. }
  3876. public LoadJobs(){
  3877. print("Loading jobs...");
  3878. new LJ[12], LJS[128], LJSS[5][11];
  3879. format(LJ, sizeof(LJ), "jobs.txt");
  3880. if(!dini_Exists(LJ)){
  3881. print("File jobs.txt does not exists");
  3882. return 1;
  3883. }
  3884. new File:LoadJob = fopen(LJ, io_read);
  3885. new jString[128];
  3886. new ID = 0;
  3887. while(fread(LoadJob, LJS)){
  3888. split(LJS, LJSS, ',');
  3889. format(Job_Infos[ID][jName], 64, "%s", LJSS[0]);
  3890. Job_Infos[ID][jType] = strval(LJSS[1]);
  3891. Job_Infos[ID][jPos_X] = floatstr(LJSS[2]);
  3892. Job_Infos[ID][jPos_Y] = floatstr(LJSS[3]);
  3893. Job_Infos[ID][jPos_Z] = floatstr(LJSS[4]);
  3894. CreatePickupEx(1210, 1, Job_Infos[ID][jPos_X], Job_Infos[ID][jPos_Y], Job_Infos[ID][jPos_Z], 0);
  3895. format(jString, sizeof(jString), "%s", Job_Infos[ID][jName]);
  3896. Create3DTextLabel(jString, COLOR_RED, Job_Infos[ID][jPos_X], Job_Infos[ID][jPos_Y], Job_Infos[ID][jPos_Z], 20, 0, 0);
  3897. format(jString, sizeof(jString), "Job: %s created", Job_Infos[ID][jName]);
  3898. print(jString);
  3899. ID++;
  3900. }
  3901. fclose(LoadJob);
  3902. return 1;
  3903. }
  3904. public AntiCheatMoney(){
  3905. new Money, ACM[256];
  3906. for(new i = 0; i < MAX_PLAYERS; i++){
  3907. if(IsPlayerConnected(i) && PlayerLogedIn[i] != 0){
  3908. Money = GetPlayerMoney(i) - GetPlayerCash(i);
  3909. if(Money >= 500){
  3910. format(ACM, sizeof(ACM), "WARNING, Maybe money cheat player %s[%d], Server: %d$, Client %d$", Player_Infos[i][pName], i, GetPlayerMoney(i), GetPlayerCash(i));
  3911. for(new ai = 0; ai < MAX_PLAYERS; ai++){
  3912. if(IsPlayerConnected(ai) && Player_Infos[ai][pAdministrator] >= 1){
  3913. SendClientMessage(ai, COLOR_RED, ACM);
  3914. }
  3915. }
  3916. }
  3917. ResetMoneyBar(i);
  3918. UpdateMoneyBar(i,Player_Infos[i][pCash]);
  3919. }
  3920. }
  3921. return 1;
  3922. }
  3923. public AntiCheatWeapon(){
  3924. new weapon, string[128];
  3925. for(new i = 0; i < MAX_PLAYERS; i++){
  3926. if(IsPlayerConnected(i) && PlayerLogedIn[i] != 0){
  3927. weapon = GetPlayerWeapon(i);
  3928. if(weapon >= 2 && weapon <= 9){
  3929. if(Player_Infos[i][pWeapon_1] != weapon){
  3930. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3931. SendClientMessage(i, COLOR_RED, string);
  3932. Kick(i);
  3933. }
  3934. }else if(weapon >= 22 && weapon <= 24){
  3935. if(Player_Infos[i][pWeapon_2] != weapon){
  3936. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3937. SendClientMessage(i, COLOR_RED, string);
  3938. Kick(i);
  3939. }
  3940. }else if(weapon >= 25 && weapon <= 27){
  3941. if(Player_Infos[i][pWeapon_3] != weapon){
  3942. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3943. SendClientMessage(i, COLOR_RED, string);
  3944. Kick(i);
  3945. }
  3946. }else if(weapon >= 28 && weapon <= 29 || weapon == 32){
  3947. if(Player_Infos[i][pWeapon_4] != weapon){
  3948. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3949. SendClientMessage(i, COLOR_RED, string);
  3950. Kick(i);
  3951. }
  3952. }else if(weapon >= 30 && weapon <= 31){
  3953. if(Player_Infos[i][pWeapon_5] != weapon){
  3954. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3955. SendClientMessage(i, COLOR_RED, string);
  3956. Kick(i);
  3957. }
  3958. }else if(weapon >= 33 && weapon <= 34){
  3959. if(Player_Infos[i][pWeapon_6] != weapon){
  3960. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3961. SendClientMessage(i, COLOR_RED, string);
  3962. Kick(i);
  3963. }
  3964. }else if(weapon >= 35 && weapon <= 38){
  3965. if(Player_Infos[i][pWeapon_7] != weapon){
  3966. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3967. SendClientMessage(i, COLOR_RED, string);
  3968. Kick(i);
  3969. }
  3970. }else if(weapon == 39){
  3971. if(Player_Infos[i][pWeapon_8] != weapon){
  3972. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3973. SendClientMessage(i, COLOR_RED, string);
  3974. Kick(i);
  3975. }
  3976. }else if(weapon >= 41 && weapon <= 43){
  3977. if(Player_Infos[i][pWeapon_9] != weapon){
  3978. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3979. SendClientMessage(i, COLOR_RED, string);
  3980. Kick(i);
  3981. }
  3982. }else if(weapon >= 10 && weapon <= 15){
  3983. if(Player_Infos[i][pWeapon_10] != weapon){
  3984. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3985. SendClientMessage(i, COLOR_RED, string);
  3986. Kick(i);
  3987. }
  3988. }else if(weapon >= 44 && weapon <= 46){
  3989. if(Player_Infos[i][pWeapon_11] != weapon){
  3990. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3991. SendClientMessage(i, COLOR_RED, string);
  3992. Kick(i);
  3993. }
  3994. }else if(weapon == 40){
  3995. if(Player_Infos[i][pWeapon_12] != weapon){
  3996. format(string, sizeof(string), "KICKED BY SYSTEM, Reason: weapon hack");
  3997. SendClientMessage(i, COLOR_RED, string);
  3998. Kick(i);
  3999. }
  4000. }
  4001. }
  4002. }
  4003. return 1;
  4004. }
  4005. stock GivePlayerGun(playerid, weapon, ammo){
  4006. if(weapon >= 2 && weapon <= 9){
  4007. Player_Infos[playerid][pWeapon_1] = weapon;
  4008. Player_Infos[playerid][pWeapon_1_Ammo] = ammo;
  4009. }else if(weapon >= 22 && weapon <= 24){
  4010. Player_Infos[playerid][pWeapon_2] = weapon;
  4011. Player_Infos[playerid][pWeapon_2_Ammo] = ammo;
  4012. }else if(weapon >= 25 && weapon <= 27){
  4013. Player_Infos[playerid][pWeapon_3] = weapon;
  4014. Player_Infos[playerid][pWeapon_3_Ammo] = ammo;
  4015. }else if(weapon >= 28 && weapon <= 29 || weapon == 32){
  4016. Player_Infos[playerid][pWeapon_4] = weapon;
  4017. Player_Infos[playerid][pWeapon_4_Ammo] = ammo;
  4018. }else if(weapon >= 30 && weapon <= 31){
  4019. Player_Infos[playerid][pWeapon_5] = weapon;
  4020. Player_Infos[playerid][pWeapon_5_Ammo] = ammo;
  4021. }else if(weapon >= 33 && weapon <= 34){
  4022. Player_Infos[playerid][pWeapon_6] = weapon;
  4023. Player_Infos[playerid][pWeapon_6_Ammo] = ammo;
  4024. }else if(weapon >= 35 && weapon <= 38){
  4025. Player_Infos[playerid][pWeapon_7] = weapon;
  4026. Player_Infos[playerid][pWeapon_7_Ammo] = ammo;
  4027. }else if(weapon == 39){
  4028. Player_Infos[playerid][pWeapon_8] = weapon;
  4029. Player_Infos[playerid][pWeapon_8_Ammo] = ammo;
  4030. }else if(weapon >= 41 && weapon <= 43){
  4031. Player_Infos[playerid][pWeapon_9] = weapon;
  4032. Player_Infos[playerid][pWeapon_9_Ammo] = ammo;
  4033. }else if(weapon >= 10 && weapon <= 15){
  4034. Player_Infos[playerid][pWeapon_10] = weapon;
  4035. Player_Infos[playerid][pWeapon_10_Ammo] = ammo;
  4036. }else if(weapon >= 44 && weapon <= 46){
  4037. Player_Infos[playerid][pWeapon_11] = weapon;
  4038. Player_Infos[playerid][pWeapon_11_Ammo] = ammo;
  4039. }else if(weapon == 40){
  4040. Player_Infos[playerid][pWeapon_12] = weapon;
  4041. Player_Infos[playerid][pWeapon_12_Ammo] = ammo;
  4042. }
  4043. GivePlayerWeapon(playerid, weapon, ammo);
  4044. return 1;
  4045. }
  4046. stock GetPlayerSpeed(playerid,bool:kmh){
  4047. new Float:Vx,Float:Vy,Float:Vz,Float:rtn;
  4048. if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz);
  4049. rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2)));
  4050. return kmh?floatround(rtn * 100 * 1.61):floatround(rtn * 100);
  4051. }
  4052. public Speedo(playerid){
  4053. new speedo_string[256];
  4054. if(ShowSpeedo[playerid] != 0){
  4055. if(GetEngineStatus(GetPlayerVehicleID(playerid))){
  4056. format(speedo_string, sizeof(speedo_string), "~n~~n~~n~~n~~n~~n~~n~~>~~w~%d ~r~KM/h, ~r~Fuel: ~w~%d~<~",GetPlayerSpeed(playerid, true), VehicleFuel[GetPlayerVehicleID(playerid)]);
  4057. GameTextForPlayer(playerid, speedo_string, 2000, 5);
  4058. return 1;
  4059. }
  4060. }
  4061. return 1;
  4062. }
  4063. public FuelSystem(){
  4064. new Driver;
  4065. new Speed;
  4066. for(new i = 0; i < MAX_VEHICLES; i++){
  4067. if(GetEngineStatus(i) && VehicleFuel[i] != 0){
  4068. Driver = HasVehicleDriver(i);
  4069. if(Driver){
  4070. Speed = GetPlayerSpeed(Driver, true);
  4071. if(Speed > 50 && Speed < 100){
  4072. VehicleFuel[i] = VehicleFuel[i] - 2;
  4073. }else if(Speed > 100){
  4074. VehicleFuel[i] = VehicleFuel[i] - 4;
  4075. }else{
  4076. VehicleFuel[i]--;
  4077. }
  4078. }
  4079. if(VehicleFuel[i] == 0){
  4080. ToggleVehicleEngine(i, 0);
  4081. }
  4082. }
  4083. }
  4084. return 1;
  4085. }
  4086. stock HasVehicleDriver(vehicle_id){
  4087. for(new i=0;i<MAX_PLAYERS;i++){
  4088. if(IsPlayerInVehicle(i, vehicle_id)){
  4089. new State = GetPlayerState(i);
  4090. if(State == PLAYER_STATE_DRIVER){
  4091. return i;
  4092. }else{
  4093. return false;
  4094. }
  4095. }
  4096. }
  4097. return true;
  4098. }
  4099. public Translate(playerid, color, const Message[], const Language[]){
  4100. new Languages[256];
  4101. new Translated_String[256];
  4102. new New_String[256];
  4103. format(Languages, sizeof(Languages), "languages/%s.ini", Language);
  4104. if(dini_Exists(Languages)){
  4105. format(New_String, sizeof(New_String), "%s", Message);
  4106. format(Translated_String, sizeof(Translated_String), "%s", dini_Get(Languages, New_String));
  4107. SendClientMessage(playerid, color, Translated_String);
  4108. }else{
  4109. SendClientMessage(playerid, color, Message);
  4110. }
  4111. }
  4112. stock abs(value){
  4113. return ((value < 0 ) ? (value * -1) : (value));
  4114. }
  4115. public BankSystem(const Option[], Amount, playerid, giveid){
  4116. new String[256];
  4117. abs(Amount);
  4118. if(strcmp(Option, "balance", true) == 0){
  4119. format(String, sizeof(String), "You have %d$ on your bank account.", Player_Infos[playerid][pBank]);
  4120. ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX , "Bank account balance.", String, "", "Ok");
  4121. return 1;
  4122. }else if(strcmp(Option, "deposit", true) == 0){
  4123. if(GetPlayerCash(playerid) >= Amount){
  4124. Player_Infos[playerid][pBank] = Player_Infos[playerid][pBank] + Amount;
  4125. GivePlayerCash(playerid, -Amount);
  4126. return 1;
  4127. }else{
  4128. return false;
  4129. }
  4130. }else if(strcmp(Option, "withdraw", true) == 0){
  4131. if(Player_Infos[playerid][pBank] >= Amount){
  4132. Player_Infos[playerid][pBank] = Player_Infos[playerid][pBank] - Amount;
  4133. GivePlayerCash(playerid, Amount);
  4134. return 1;
  4135. }else{
  4136. return false;
  4137. }
  4138. }else if(strcmp(Option, "transfer", true) == 0){
  4139. if(IsPlayerConnected(giveid)){
  4140. if(Player_Infos[playerid][pBank] >= Amount){
  4141. Player_Infos[giveid][pBank] = Player_Infos[giveid][pBank] + Amount;
  4142. Player_Infos[playerid][pBank] = Player_Infos[playerid][pBank] - Amount;
  4143. return 1;
  4144. }else{
  4145. return false;
  4146. }
  4147. }else{
  4148. return 0;
  4149. }
  4150. }
  4151. return 1;
  4152. }
  4153. public VehiclePlates(){
  4154. new File:VehiclePlatesFile = fopen("vehicle_plates.txt", io_read);
  4155. if(!dini_Exists("vehicle_plates.txt")){
  4156. return 1;
  4157. }
  4158. new String[256];
  4159. new plate = 0;
  4160. while(fread(VehiclePlatesFile, String)){
  4161. VehiclePlatesSys[plate][Number] = strval(String);
  4162. plate++;
  4163. }
  4164. return 1;
  4165. }
  4166. public GenerateVehiclePlate(){
  4167. new File:PlatesFile = fopen("vehicle_plates.txt", io_append);
  4168. new Plate[6];
  4169. for(new p=0;p<7;p++){
  4170. format(Plate, sizeof(Plate), "%s%s", Plate, random(9));
  4171. }
  4172. for(new i=0;i<sizeof(VehiclePlatesSys);i++){
  4173. if(VehiclePlatesSys[i][Number] == strval(Plate)){
  4174. GenerateVehiclePlate();
  4175. return 1;
  4176. }
  4177. }
  4178. fwrite(PlatesFile, Plate);
  4179. fclose(PlatesFile);
  4180. return 1;
  4181. }
  4182. public AddAtm(playerid){
  4183. new Float:X, Float:Y, Float:Z, Float:FA;
  4184. GetPlayerPos(playerid, X, Y, Z);
  4185. GetPlayerFacingAngle(playerid, FA);
  4186. new File:ATMS = fopen("atms.txt", io_append);
  4187. new Params[256];
  4188. format(Params, sizeof(Params), "%f,%f,%f,%f\n\r", X, Y, Z, FA);
  4189. fwrite(ATMS, Params);
  4190. fclose(ATMS);
  4191. return 1;
  4192. }
  4193. public LoadAtms(){
  4194. if(!fexist("atms.txt")){
  4195. return 1;
  4196. }
  4197. new File:LoadATMs = fopen("atms.txt", io_read);
  4198. new ATMS[256], ATM_Params[5][20];
  4199. for(new i = 0; i < sizeof(ATM_Infos); i++){
  4200. DestroyObject(ATM_Infos[i][atm_objid]);
  4201. }
  4202. new atm = 0;
  4203. while(fread(LoadATMs, ATMS)){
  4204. split(ATMS, ATM_Params, ',');
  4205. ATM_Infos[atm][atm_x] = floatstr(ATM_Params[0]);
  4206. ATM_Infos[atm][atm_y] = floatstr(ATM_Params[1]);
  4207. ATM_Infos[atm][atm_z] = floatstr(ATM_Params[2]);
  4208. ATM_Infos[atm][atm_objid] = CreateObject(2942, floatstr(ATM_Params[0]), floatstr(ATM_Params[1]), floatstr(ATM_Params[2]) - 1, 0.0, 0.0, floatstr(ATM_Params[3]));
  4209. atm++;
  4210. }
  4211. fclose(LoadATMs);
  4212. return 1;
  4213. }
  4214. public AddUsableCommand(rank, type, const command[]){
  4215. new Type[64];
  4216. format(Type, sizeof(Type), "Commands/type_%d.txt", type);
  4217. new File:CommandFile = fopen(Type, io_append);
  4218. format(Type, sizeof(Type), "%s,%d\n", command, rank);
  4219. fwrite(CommandFile, Type);
  4220. fclose(CommandFile);
  4221. return 1;
  4222. }
  4223. public LoadUsableCommands(type){
  4224. new Type[64];
  4225. format(Type, sizeof(Type), "Commands/type_%d.txt", type);
  4226. if(!fexist(Type)){
  4227. return 1;
  4228. }
  4229. new File:LoadCommands = fopen(Type, io_read);
  4230. new Command[64], Command_Split[3][12];
  4231. while(fread(LoadCommands, Command)){
  4232. split(Command, Command_Split, ',');
  4233. UsableCommands[GlobalType][uctype] = type;
  4234. UsableCommands[GlobalType][ucrank] = strval(Command_Split[1]);
  4235. format(UsableCommands[GlobalType][ucc], 64, "%s", Command_Split[0]);
  4236. GlobalType++;
  4237. }
  4238. return 1;
  4239. }
  4240. public IsUsableCommand(rank, type, const command[]){
  4241. for(new i = 0; i < GlobalType; i++){
  4242. printf("%s = %s %d = %d %d = %d", UsableCommands[i][ucc], command, UsableCommands[i][uctype], type, UsableCommands[i][ucrank], rank);
  4243. if(!strcmp(command, UsableCommands[i][ucc], true) && UsableCommands[i][uctype] == type && UsableCommands[i][ucrank] == rank){
  4244. return 1;
  4245. }
  4246. }
  4247. return 0;
  4248. }
  4249. public FixVehicle(playerid, vehicleid){
  4250. ClearAnimations(playerid);
  4251. GameTextForPlayer(playerid, "Vehicle fixed.", 3000, 3);
  4252. if(vehicleid == Player_Infos[playerid][pSpawned_Vehicle]){
  4253. switch(Player_Infos[playerid][pSpawned_Vehicle_Slot]){
  4254. case 1:{
  4255. GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Panel_Status], Player_Infos[playerid][pVehicle_1_Doors_Status], Player_Infos[playerid][pVehicle_1_Lights_Status], Player_Infos[playerid][pVehicle_1_Tires_Status]);
  4256. GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_1_Health]);
  4257. }
  4258. case 2:{
  4259. GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Panel_Status], Player_Infos[playerid][pVehicle_2_Doors_Status], Player_Infos[playerid][pVehicle_2_Lights_Status], Player_Infos[playerid][pVehicle_2_Tires_Status]);
  4260. GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_2_Health]);
  4261. }
  4262. case 3:{
  4263. GetVehicleDamageStatus(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Panel_Status], Player_Infos[playerid][pVehicle_3_Doors_Status], Player_Infos[playerid][pVehicle_3_Lights_Status], Player_Infos[playerid][pVehicle_3_Tires_Status]);
  4264. GetVehicleHealth(Player_Infos[playerid][pSpawned_Vehicle], Player_Infos[playerid][pVehicle_3_Health]);
  4265. }
  4266. }
  4267. }
  4268. RepairVehicle(vehicleid);
  4269. return 1;
  4270. }
  4271. stock IsPlayerNearATM(playerid){
  4272. for(new i = 0; i < sizeof(ATM_Infos);i++){
  4273. if(IsPlayerInRangeOfPoint(playerid, 2.0, ATM_Infos[i][atm_x], ATM_Infos[i][atm_y], ATM_Infos[i][atm_z])){
  4274. return 1;
  4275. }
  4276. }
  4277. return false;
  4278. }
  4279. stock IsPlayerNearGasStation(playerid, &gsid){
  4280. for(new i = 0; i < MAX_GASSTATIONS; i++){
  4281. if(IsPlayerInRangeOfPoint(playerid, 10.0, GasStations[i][gssx], GasStations[i][gssy], GasStations[i][gssz])){
  4282. gsid = i;
  4283. return 1;
  4284. }
  4285. }
  4286. return false;
  4287. }
  4288. stock IsPlayerNearJob(playerid, &jobid){
  4289. for(new i = 0; i < MAX_JOBS; i++){
  4290. if(IsPlayerInRangeOfPoint(playerid, 3.0, Job_Infos[i][jPos_X], Job_Infos[i][jPos_Y], Job_Infos[i][jPos_Z])){
  4291. jobid = i;
  4292. return 1;
  4293. }
  4294. }
  4295. return 0;
  4296. }
  4297. stock GetNearestVehicleID(playerid, Float:range, &vehicleid){
  4298. new Float:X, Float:Y, Float:Z;
  4299. for(new i = 0; i < MAX_VEHICLES; i++){
  4300. if(IsVehicleStreamedIn(i, playerid)){
  4301. GetVehiclePos(i, X, Y, Z);
  4302. if(IsPlayerInRangeOfPoint(playerid, range, X, Y, Z)){
  4303. vehicleid = i;
  4304. return 1;
  4305. }
  4306. }
  4307. }
  4308. return false;
  4309. }
  4310.  
  4311. stock GetJobType(playerid){
  4312. if(Player_Infos[playerid][pJob] == 255){
  4313. return 0;
  4314. }else{
  4315. return Job_Infos[Player_Infos[playerid][pJob]][jType];
  4316. }
  4317. }
  4318.  
  4319. stock GetPlayerFactionInfos(playerid, &type, &rank){
  4320. if(Player_Infos[playerid][pFaction] == 255){
  4321. type = -1;
  4322. rank = 0;
  4323. return 1;
  4324. }
  4325. type = Faction_Infos[Player_Infos[playerid][pFaction]][fFaction_Type];
  4326. rank = Player_Infos[playerid][pFaction_Rank];
  4327. return 1;
  4328. }
  4329. public DragPlayer(playerid, id){
  4330. new Float:X, Float:Y, Float:Z, Float:FA;
  4331. GetPlayerPos(playerid, X, Y, Z);
  4332. GetPlayerFacingAngle(playerid, FA);
  4333. GetDirectedXY(1, playerid, X, Y, 2.0, 0);
  4334. SetPlayerPos(id, X, Y, Z);
  4335. SetPlayerFacingAngle(id, FA);
  4336. return 1;
  4337. }
  4338. stock GetDirectedXY(type, id, &Float:x, &Float:y, Float:distance, Direction)
  4339. {
  4340. new Float:rx, Float:ry, Float:a;
  4341. if(type == 1){
  4342. GetPlayerFacingAngle(id, a);
  4343. }else if(type == 2){
  4344. GetObjectRot(id, rx, ry, a);
  4345. }
  4346. if(Direction <= 0){
  4347. x -= (distance * floatsin(-a, degrees));
  4348. y -= (distance * floatcos(-a, degrees));
  4349. }else if(Direction >= 1){
  4350. x += (distance * floatsin(-a, degrees));
  4351. y += (distance * floatcos(-a, degrees));
  4352. }
  4353. }
  4354. stock IsFreeSeat(vehicleid, seat){
  4355. new SeatID;
  4356. for(new i = 0; i < MAX_PLAYERS; i++){
  4357. if(IsPlayerConnected(i) && IsPlayerInVehicle(i, vehicleid)){
  4358. SeatID = GetPlayerVehicleSeat(i);
  4359. if(SeatID == 128){
  4360. IsFreeSeat(vehicleid, seat);
  4361. }else if(SeatID == seat){
  4362. return false;
  4363. }
  4364. }
  4365. }
  4366. return 1;
  4367. }
  4368. stock IsPlayerAdministrator(playerid, level){
  4369. if(Player_Infos[playerid][pAdministrator] >= level){
  4370. return true;
  4371. }else{
  4372. return false;
  4373. }
  4374. }
  4375.  
  4376. stock IsPlayerNearObject(playerid, object, Float:radius, &objid){
  4377. switch(object){
  4378. case OBJ_HOUSE:{
  4379. for(new i=0;i<MAX_HOUSES;i++){
  4380. if(IsPlayerInRangeOfPoint(playerid, radius, HouseInfos[i][HouseEnterX], HouseInfos[i][HouseEnterY], HouseInfos[i][HouseEnterZ])){
  4381. objid = i;
  4382. return 1;
  4383. }
  4384. }
  4385. }
  4386. case OBJ_FACTION:{
  4387. for(new fi = 0; fi < MAX_FACTIONS; fi++){
  4388. if(IsPlayerInRangeOfPoint(playerid, 2,Faction_Infos[fi][fFaction_HQ_X], Faction_Infos[fi][fFaction_HQ_Y], Faction_Infos[fi][fFaction_HQ_Z])){
  4389. objid = fi;
  4390. return 1;
  4391. }
  4392. }
  4393. }
  4394. case OBJ_BUSINESS:{
  4395. for(new bi = 0; bi < MAX_BUSINESS; bi++){
  4396. if(IsPlayerInRangeOfPoint(playerid, 2, Business_Infos[bi][bizEntrance_X], Business_Infos[bi][bizEntrance_Y], Business_Infos[bi][bizEntrance_Z])){
  4397. objid = bi;
  4398. return 1;
  4399. }
  4400. }
  4401. }
  4402. case OBJ_STORE:{
  4403. for(new si = 0; si < MAX_24_7_STORES; si++){
  4404. if(IsPlayerInRangeOfPoint(playerid, 2, Stores_Infos[si][sEnter_X], Stores_Infos[si][sEnter_Y], Stores_Infos[si][sEnter_Z])){
  4405. objid = si;
  4406. return 1;
  4407. }
  4408. }
  4409. }
  4410. case OBJ_BANK:{
  4411. for(new bnk = 0; bnk < MAX_BANKS; bnk++){
  4412. if(IsPlayerInRangeOfPoint(playerid, 2, BankInfos[bnk][BankExitX], BankInfos[bnk][BankExitY], BankInfos[bnk][BankExitZ])){
  4413. objid = bnk;
  4414. return 1;
  4415. }
  4416. }
  4417. }
  4418. }
  4419. return false;
  4420. }
  4421.  
  4422. stock PutPlayerInHouse(playerid, houseid){
  4423. Player_Infos[playerid][pObjectEnterX] = HouseInfos[houseid][HouseEnterX];
  4424. Player_Infos[playerid][pObjectEnterY] = HouseInfos[houseid][HouseEnterY];
  4425. Player_Infos[playerid][pObjectEnterZ] = HouseInfos[houseid][HouseEnterZ];
  4426. Player_Infos[playerid][pObjectExitX] = HouseInfos[houseid][HouseInteriorX];
  4427. Player_Infos[playerid][pObjectExitY] = HouseInfos[houseid][HouseInteriorY];
  4428. Player_Infos[playerid][pObjectExitZ] = HouseInfos[houseid][HouseInteriorZ];
  4429. Player_Infos[playerid][pObjectInterior] = HouseInfos[houseid][HouseInteriorID];
  4430. Player_Infos[playerid][pInObject] = houseid;
  4431. Player_Infos[playerid][pObjectType] = OBJ_HOUSE;
  4432. SetPlayerInterior(playerid, HouseInfos[houseid][HouseInteriorID]);
  4433. SetPlayerPos(playerid, HouseInfos[houseid][HouseInteriorX], HouseInfos[houseid][HouseInteriorY], HouseInfos[houseid][HouseInteriorZ]);
  4434. SetPlayerVirtualWorld(playerid, houseid);
  4435. if(Player_Infos[playerid][pDraging] != -1){
  4436. SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
  4437. SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
  4438. }
  4439. return 1;
  4440. }
  4441.  
  4442. stock PutPlayerInFaction(playerid, factionid){
  4443. Player_Infos[playerid][pObjectEnterX] = Faction_Infos[factionid][fFaction_HQ_X];
  4444. Player_Infos[playerid][pObjectEnterY] = Faction_Infos[factionid][fFaction_HQ_Y];
  4445. Player_Infos[playerid][pObjectEnterZ] = Faction_Infos[factionid][fFaction_HQ_Z];
  4446. Player_Infos[playerid][pObjectExitX] = Faction_Infos[factionid][fFaction_HQ_Inside_X];
  4447. Player_Infos[playerid][pObjectExitY] = Faction_Infos[factionid][fFaction_HQ_Inside_Y];
  4448. Player_Infos[playerid][pObjectExitZ] = Faction_Infos[factionid][fFaction_HQ_Inside_Z];
  4449. Player_Infos[playerid][pObjectInterior] = Faction_Infos[factionid][fFaction_HQ_Inside_Interior];
  4450. Player_Infos[playerid][pInObject] = factionid;
  4451. Player_Infos[playerid][pObjectType] = OBJ_FACTION;
  4452. SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
  4453. SetPlayerPos(playerid, Faction_Infos[factionid][fFaction_HQ_Inside_X], Faction_Infos[factionid][fFaction_HQ_Inside_Y], Faction_Infos[factionid][fFaction_HQ_Inside_Z]);
  4454. SetPlayerVirtualWorld(playerid, factionid);
  4455. if(Player_Infos[playerid][pDraging] != -1){
  4456. SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
  4457. SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
  4458. }
  4459. return 1;
  4460. }
  4461.  
  4462. stock PutPlayerInBusiness(playerid, businessid){
  4463. if(GetPlayerCash(playerid) < Business_Infos[businessid][bizEnter_Fee]){
  4464. SendClientMessage(playerid, COLOR_RED, "You need more money to enter this business.");
  4465. return 1;
  4466. }
  4467. new tmpstr[128], amount, id;
  4468. format(tmpstr, sizeof(tmpstr), "Players/%s.ini", Business_Infos[businessid][bizOwner_Name]);
  4469. if(!dini_Exists(tmpstr)) return true;
  4470. amount = dini_Int(tmpstr, "Bank");
  4471. dini_IntSet(tmpstr, "Bank", amount+strval(Business_Infos[businessid][bizEnter_Fee]));
  4472. GetPlayerIDByName(Business_Infos[businessid][bizOwner_Name], id);
  4473. if(IsPlayerConnected(id)){
  4474. Player_Infos[id][pBank] = amount+strval(Business_Infos[businessid][bizEnter_Fee]);
  4475. format(tmpstr, sizeof(tmpstr), "%s entered to your business, your bank money rises from %d to %d", Player_Infos[playerid][pName], amount, Player_Infos[id][pBank]);
  4476. SendClientMessage(id, COLOR_YELLOW, tmpstr);
  4477. }
  4478. Player_Infos[playerid][pObjectEnterX] = Business_Infos[businessid][bizEntrance_X];
  4479. Player_Infos[playerid][pObjectEnterY] = Business_Infos[businessid][bizEntrance_Y];
  4480. Player_Infos[playerid][pObjectEnterZ] = Business_Infos[businessid][bizEntrance_Z];
  4481. Player_Infos[playerid][pObjectExitX] = Business_Infos[businessid][bizInterior_X];
  4482. Player_Infos[playerid][pObjectExitY] = Business_Infos[businessid][bizInterior_Y];
  4483. Player_Infos[playerid][pObjectExitZ] = Business_Infos[businessid][bizInterior_Z];
  4484. Player_Infos[playerid][pObjectInterior] = Business_Infos[businessid][bizInterior];
  4485. Player_Infos[playerid][pInObject] = businessid;
  4486. Player_Infos[playerid][pObjectType] = OBJ_BUSINESS;
  4487. SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
  4488. SetPlayerPos(playerid, Business_Infos[businessid][bizInterior_X], Business_Infos[businessid][bizInterior_Y], Business_Infos[businessid][bizInterior_Z]);
  4489. SetPlayerVirtualWorld(playerid, businessid);
  4490. if(Player_Infos[playerid][pDraging] != -1){
  4491. SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
  4492. SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
  4493. }
  4494. return 1;
  4495. }
  4496.  
  4497. stock PutPlayerInStore(playerid, storeid){
  4498. Player_Infos[playerid][pObjectEnterX] = Stores_Infos[storeid][sEnter_X];
  4499. Player_Infos[playerid][pObjectEnterY] = Stores_Infos[storeid][sEnter_Y];
  4500. Player_Infos[playerid][pObjectEnterZ] = Stores_Infos[storeid][sEnter_Z];
  4501. Player_Infos[playerid][pObjectExitX] = Stores_Infos[storeid][sInt_X];
  4502. Player_Infos[playerid][pObjectExitY] = Stores_Infos[storeid][sInt_Y];
  4503. Player_Infos[playerid][pObjectExitZ] = Stores_Infos[storeid][sInt_Z];
  4504. Player_Infos[playerid][pObjectInterior] = Stores_Infos[storeid][sInt];
  4505. Player_Infos[playerid][pInObject] = storeid;
  4506. Player_Infos[playerid][pObjectType] = OBJ_STORE;
  4507. SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
  4508. SetPlayerPos(playerid, Stores_Infos[storeid][sInt_X], Stores_Infos[storeid][sInt_Y], Stores_Infos[storeid][sInt_Z]);
  4509. SetPlayerVirtualWorld(playerid, storeid);
  4510. if(Player_Infos[playerid][pDraging] != -1){
  4511. SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
  4512. SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
  4513. }
  4514. return 1;
  4515. }
  4516.  
  4517. stock PutPlayerInBank(playerid, bankid){
  4518. Player_Infos[playerid][pObjectEnterX] = BankInfos[bankid][BankExitX];
  4519. Player_Infos[playerid][pObjectEnterY] = BankInfos[bankid][BankExitY];
  4520. Player_Infos[playerid][pObjectEnterZ] = BankInfos[bankid][BankExitZ];
  4521. Player_Infos[playerid][pObjectExitX] = BankInfos[bankid][BankEnterX];
  4522. Player_Infos[playerid][pObjectExitY] = BankInfos[bankid][BankEnterY];
  4523. Player_Infos[playerid][pObjectExitZ] = BankInfos[bankid][BankEnterZ];
  4524. Player_Infos[playerid][pInObject] = bankid;
  4525. Player_Infos[playerid][pObjectInterior] = BankInfos[bankid][BankInteriorID];
  4526. Player_Infos[playerid][pObjectType] = OBJ_BANK;
  4527. SetPlayerInterior(playerid, Player_Infos[playerid][pObjectInterior]);
  4528. SetPlayerPos(playerid, BankInfos[bankid][BankEnterX], BankInfos[bankid][BankEnterY], BankInfos[bankid][BankEnterZ]);
  4529. SetPlayerVirtualWorld(playerid, bankid);
  4530. if(Player_Infos[playerid][pDraging] != -1){
  4531. SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
  4532. SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
  4533. }
  4534. return 1;
  4535. }
  4536.  
  4537. stock PutPlayerInObject(playerid){
  4538. new ID;
  4539. if(IsPlayerNearObject(playerid, OBJ_HOUSE, 2.0, ID)){
  4540. if(HouseInfos[ID][Locked] == 1){
  4541. GameTextForPlayer(playerid, "~r~This house is locked", 3000, 6);
  4542. return 1;
  4543. }
  4544. PutPlayerInHouse(playerid, ID);
  4545. return 1;
  4546. }else if(IsPlayerNearObject(playerid, OBJ_FACTION, 2.0, ID)){
  4547. PutPlayerInFaction(playerid, ID);
  4548. return 1;
  4549. }else if(IsPlayerNearObject(playerid, OBJ_BUSINESS, 2.0, ID)){
  4550. if(Business_Infos[ID][bizLocked] == 1){
  4551. GameTextForPlayer(playerid, "~r~This business is locked", 3000, 6);
  4552. return 1;
  4553. }
  4554. PutPlayerInBusiness(playerid, ID);
  4555. return 1;
  4556. }else if(IsPlayerNearObject(playerid, OBJ_STORE, 2.0, ID)){
  4557. PutPlayerInStore(playerid, ID);
  4558. return 1;
  4559. }else if(IsPlayerNearObject(playerid, OBJ_BANK, 2.0, ID)){
  4560. PutPlayerInBank(playerid, ID);
  4561. return 1;
  4562. }else{
  4563. return 1;
  4564. }
  4565. }
  4566. stock RemovePlayerFromObject(playerid){
  4567. if(Player_Infos[playerid][pInObject] != -1){
  4568. if(IsPlayerInRangeOfPoint(playerid, 2, Player_Infos[playerid][pObjectExitX], Player_Infos[playerid][pObjectExitY], Player_Infos[playerid][pObjectExitZ])){
  4569. Player_Infos[playerid][pInObject] = -1;
  4570. Player_Infos[playerid][pObjectType] = 0;
  4571. SetPlayerPos(playerid, Player_Infos[playerid][pObjectEnterX], Player_Infos[playerid][pObjectEnterY], Player_Infos[playerid][pObjectEnterZ]);
  4572. SetPlayerInterior(playerid, 0);
  4573. SetPlayerVirtualWorld(playerid, 0);
  4574. if(Player_Infos[playerid][pDraging] != -1){
  4575. SetPlayerVirtualWorld(Player_Infos[playerid][pDraging], Player_Infos[playerid][pInObject]);
  4576. SetPlayerInterior(Player_Infos[playerid][pDraging], Player_Infos[playerid][pObjectInterior]);
  4577. }
  4578. }
  4579. }
  4580. }
  4581. public TazePlayer(playerid){
  4582. TogglePlayerControllable(playerid, 1);
  4583. Player_Infos[playerid][pTazed] = 0;
  4584. return 1;
  4585. }
  4586. public StealVehicle(playerid, vehicleid){
  4587. PutPlayerInVehicle(playerid, vehicleid, 0);
  4588. TogglePlayerControllable(playerid, 1);
  4589. Player_Infos[playerid][pStealing] = 0;
  4590. GameTextForPlayer(playerid, "~g~Engine started", 3000, 6);
  4591. ToggleVehicleEngine(vehicleid, 1);
  4592. return 1;
  4593. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement