Advertisement
Gireada

Vehicule Pers 4

Apr 8th, 2013
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 57.75 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <sscanf2>
  4. #include <zcmd>
  5. #include <mSelection>
  6.  
  7. #define PURPLE 0xFF00FFFF
  8. #define Dialog_Manual 888
  9. #define Dialog_Pret 889
  10. #define Dialog_Culoare1 890
  11. #define Dialog_Culoare2 891
  12.  
  13. new vehicule = mS_INVALID_LISTID;
  14.  
  15. new VanzatorVeh[MAX_PLAYERS];
  16. new carsshow[MAX_PLAYERS];
  17. new IDVehicul[MAX_PLAYERS];
  18. new PretVehicul[MAX_PLAYERS];
  19. new neonon[MAX_VEHICLES];
  20. new neon[MAX_VEHICLES][5];
  21. new motoron[MAX_VEHICLES];
  22. new Text3D:vtextlabel[1000];
  23.  
  24. new vehicul[MAX_PLAYERS];
  25. new vehiculpret[MAX_PLAYERS];
  26. new vehiculculoare1[MAX_PLAYERS];
  27. new vehiculculoare2[MAX_PLAYERS];
  28.  
  29.  
  30. new maxperscar = 9;//Numarul maxim de vehicule pe care un jucator le poate avea
  31. new buyablecars = 114;//Cate vehicule ai pe server +1;
  32.  
  33. new Contuar[MAX_PLAYERS];
  34. new Metrii[MAX_VEHICLES];
  35.  
  36. new VehicleNames[212][] = {
  37. {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
  38. {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
  39. {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
  40. {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
  41. {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
  42. {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
  43. {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
  44. {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
  45. {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
  46. {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
  47. {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
  48. {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
  49. {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
  50. {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
  51. {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
  52. {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
  53. {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
  54. {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
  55. {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
  56. {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
  57. {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
  58. {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
  59. {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
  60. {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
  61. {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
  62. {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
  63. {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
  64. {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
  65. {"Utility Trailer"}};
  66.  
  67. forward LoadCar();
  68. forward SaveCar();
  69. forward SaveThisCar(vehid);
  70. forward IsAnOwnableCar(vehicleid);
  71. forward IsAtDealership(playerid);
  72. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  73. forward SendAdminMesaj(color,const string[]);
  74. forward GetDistanceToCar(playerid,carid);
  75. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  76. forward VerificaKilometri(vehicleid);
  77.  
  78. new vindelevel = 0;// Nivelul de la care poti cumpara un vehicul
  79.  
  80. enum PlayerData
  81. {
  82.     pLoggedIn,
  83.     pVehicule,
  84. }
  85. new PlayerInfo[MAX_PLAYERS][PlayerData];
  86.  
  87. enum vInfo
  88. {
  89.     Model,
  90.     Float:Locatiex,
  91.     Float:Locatiey,
  92.     Float:Locatiez,
  93.     Float:Rotatie,
  94.     Valoare,
  95.     Culoare1,
  96.     Culoare2,
  97.     Propietar[MAX_PLAYER_NAME],
  98.     Cumparata,
  99.     Inchisa,
  100.     Neon,
  101.     Numar,
  102.     PaintJob,
  103.     Km,
  104. }
  105. new VehInfo[MAX_VEHICLES][vInfo];
  106.  
  107. public OnGameModeInit()
  108. {
  109.     LoadCar();
  110.     return 1;
  111. }
  112.  
  113. public OnFilterScriptInit()
  114. {
  115.     print("\n--------------------------------------");
  116.     print(" Vehicule personale by Gireada");
  117.     print("--------------------------------------\n");
  118.     vehicule = LoadModelSelectionMenu("vehicule.txt");
  119.     for(new veh = buyablecars; veh < MAX_VEHICLES; veh++)
  120.     {
  121.         SetVehicleParamsEx(veh,false,false,false,VehInfo[veh][Inchisa],false,false,false);
  122.         motoron[veh] = 0;
  123.     }
  124.     return 1;
  125. }
  126.  
  127. public OnFilterScriptExit()
  128. {
  129.     SaveCar();
  130.     return 1;
  131. }
  132.  
  133. main()
  134. {
  135.     print("\n----------------------------------");
  136.     print(" Vehicule personale by Gireada");
  137.     print("----------------------------------\n");
  138. }
  139.  
  140. public IsAtDealership(playerid)
  141. {
  142.     if(IsPlayerConnected(playerid))
  143.     {
  144.         if(PlayerToPoint(25.0,playerid,2128.0864,-1135.3912,25.5855) || PlayerToPoint(50,playerid,537.3366,-1293.2140,17.2422) || PlayerToPoint(35,playerid,2521.5544,-1524.4504,23.8365) || PlayerToPoint(50,playerid,2155.0146,-1177.3333,23.8211) || PlayerToPoint(50,playerid,299.1723,-1518.6627,24.6007) || PlayerToPoint(50,playerid,221.6332,-1952.4972,-0.5304) || PlayerToPoint(50,playerid,223.8193,-1905.8246,-0.5363) || PlayerToPoint(50,playerid,1258.2405,-1817.7858,13.4052))
  145.         {
  146.             return 1;
  147.         }
  148.     }
  149.     return 0;
  150. }
  151.  
  152. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  153. {
  154.     new Float:oldposx, Float:oldposy, Float:oldposz;
  155.     new Float:tempposx, Float:tempposy, Float:tempposz;
  156.     GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  157.     tempposx = (oldposx -x);
  158.     tempposy = (oldposy -y);
  159.     tempposz = (oldposz -z);
  160.     //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  161.     if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  162.     {
  163.         return 1;
  164.     }
  165.     return 1;
  166.  
  167. }
  168.  
  169. public IsAnOwnableCar(vehicleid)
  170. {
  171.     if(vehicleid >= buyablecars && vehicleid <= 1000) { return 1; }
  172.     return 0;
  173. }
  174.  
  175. CMD:rac(playerid, params[])
  176. {
  177.     new string[256], nume[MAX_PLAYER_NAME];
  178.     GetPlayerName(playerid, nume, sizeof(nume));
  179.     if(IsPlayerAdmin(playerid))
  180.     {
  181.         for(new i=0;i<MAX_VEHICLES;i++)
  182.         {
  183.             if(!IsVehicleOccupied(i))
  184.             {
  185.                 if(IsAnOwnableCar(i))
  186.                 {
  187.                     SetVehiclePos(i, VehInfo[i][Locatiex], VehInfo[i][Locatiey], VehInfo[i][Locatiez]);
  188.                     SetVehicleZAngle(i, VehInfo[i][Rotatie]);
  189.                     //SetVehicleToRespawn(i);
  190.                 }
  191.                 else
  192.                 {
  193.                     SetVehicleToRespawn(i);
  194.                 }
  195.             }
  196.         }
  197.         format(string, sizeof(string), "Admin-ul %s a dat RAC(Respawn All Car)",nume);
  198.         SendClientMessageToAll(0xFFFFFFFF, string);
  199.     }
  200.     else
  201.     {
  202.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii admin RCON");
  203.         return 1;
  204.     }
  205.     return 1;
  206. }
  207.  
  208. CMD:rpv(playerid, params[])
  209. {
  210.     new string[256], nume[MAX_PLAYER_NAME];
  211.     GetPlayerName(playerid, nume, sizeof(nume));
  212.     if(IsPlayerAdmin(playerid))
  213.     {
  214.         for(new i=buyablecars;i<MAX_VEHICLES;i++)
  215.         {
  216.             if(!(IsVehicleOccupied(i)))
  217.             {
  218.                 SetVehiclePos(i, VehInfo[i][Locatiex], VehInfo[i][Locatiey], VehInfo[i][Locatiez]);
  219.                 SetVehicleZAngle(i, VehInfo[i][Rotatie]);
  220.             }
  221.         }
  222.         format(string, sizeof(string), "Admin-ul %s a dat RPV(Respawn Personal Vehicle)",nume);
  223.         SendClientMessageToAll(0xFFFFFFFF, string);
  224.     }
  225.     else
  226.     {
  227.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii admin RCON");
  228.         return 1;
  229.     }
  230.     return 1;
  231. }
  232.  
  233. CMD:rtpv(playerid, params[])
  234. {
  235.     new i=GetPlayerVehicleID(playerid);
  236.     if(IsPlayerAdmin(playerid))
  237.     {
  238.         SetVehiclePos(i, VehInfo[i][Locatiex], VehInfo[i][Locatiey], VehInfo[i][Locatiez]);
  239.         SetVehicleZAngle(i, VehInfo[i][Rotatie]);
  240.     }
  241.     else
  242.     {
  243.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii admin RCON");
  244.     }
  245.     return 1;
  246. }
  247.  
  248.  
  249. CMD:asellcar(playerid, params[])
  250. {
  251.     new file[512], string[256];
  252.     new Float:x, Float:y, Float:z;
  253.     GetPlayerPos(playerid, x, y, z);
  254.     new carid = GetPlayerVehicleID(playerid);
  255.     new Dealer[MAX_PLAYER_NAME];
  256.     format(Dealer, 32 ,"Dealer");
  257.     new name[MAX_PLAYER_NAME];
  258.     GetPlayerName(playerid, name, sizeof(name));
  259.     if(IsPlayerAdmin(playerid))
  260.     {
  261.         if(IsPlayerConnected(playerid))
  262.         {
  263.             if(!IsAnOwnableCar(carid))
  264.             {
  265.                 SendClientMessage(playerid, 0xFFFFFFFF, "Acest vehicul apartine unei factiuni/job");
  266.             }
  267.             if(IsAtDealership(playerid))
  268.             {
  269.                 SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii la dealer");
  270.             }
  271.             if(!(strcmp(VehInfo[carid][Propietar], Dealer, true) == 0))
  272.             {
  273.                 format(file, sizeof(file), "JucatoriVehicule/%s.ini", VehInfo[carid][Propietar]);
  274.                 dini_IntSet(file,"Vehicule",PlayerInfo[playerid][pVehicule]-1); VehInfo[carid][Cumparata] = 0;
  275.                 strmid(VehInfo[carid][Numar], "DeVanzare", 0, strlen("DeVanzare"), 999); SetVehicleNumberPlate(carid,VehInfo[carid][Numar]);
  276.                 VehInfo[carid][Locatiex] = x;  VehInfo[carid][Locatiey] = y; VehInfo[carid][Locatiez] = z; VehInfo[carid][Rotatie]= 1;
  277.                 strmid(VehInfo[carid][Propietar], "Dealer", 0, strlen("Dealer"), 999); VehInfo[carid][Cumparata] = 0; VehInfo[carid][Neon] = 0;
  278.                 format(string, sizeof(string), " Vehiculul %d a fost vandut cu succes. Felicitari!.", carid);
  279.                 SendClientMessage(playerid, 0xFFFFFFFF, string);
  280.                 format(string, sizeof(string), " %s a vandut vehiculul %d.",name, carid);
  281.                 SendAdminMesaj(0xFFFFFFFF,string);
  282.             }
  283.             else
  284.             {
  285.                 SendClientMessage(playerid, 0xFFFFFFFF, "Acest vehicul este deja de vanzare");
  286.             }
  287.         }
  288.         else
  289.         {
  290.             SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii conectat");
  291.         }
  292.     }
  293.     else
  294.     {
  295.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii admin RCON");
  296.     }
  297.     return 1;
  298. }
  299. CMD:cumparaneon(playerid, params[])
  300. {
  301.     new tip;
  302.     new vehid = GetPlayerVehicleID(playerid);
  303.     new name[MAX_PLAYERS];
  304.     GetPlayerName(playerid,name,sizeof(name));
  305.     if(unformat(params, "i", tip))
  306.     {
  307.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /cumparaneon <culoare>");
  308.             return 1;
  309.     }
  310.     if(!(tip>0 && tip < 7))
  311.     {
  312.         SendClientMessage(playerid, 0xFFFFFFFF, "Culori neon:");
  313.         SendClientMessage(playerid, 0xFFFFFFFF, "1.Rosu 2.Verde");
  314.         SendClientMessage(playerid, 0xFFFFFFFF, "3.Verde Lamai 4.Abastru");
  315.         SendClientMessage(playerid, 0xFFFFFFFF, "5.Alb 6.Violet");
  316.     }
  317.     if(IsAtDealership(playerid))
  318.     {
  319.         if(strcmp(VehInfo[vehid][Propietar], name, true) == 0)
  320.         {
  321.             if(neonon[vehid] == 0)
  322.             {
  323.                 if(GetPlayerMoney(playerid) >= 100)
  324.                 {
  325.                     if(tip == 1)
  326.                     {
  327.                         VehInfo[vehid][Neon] = 1;
  328.                         SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari pentru noua achizitie. Te-a costat 100$");
  329.                         GivePlayerMoney(playerid, -100);
  330.                     }
  331.                     else if(tip == 2)
  332.                     {
  333.                         VehInfo[vehid][Neon] = 2;
  334.                         SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari pentru noua achizitie. Te-a costat 100$");
  335.                         GivePlayerMoney(playerid, -100);
  336.                     }
  337.                     else if(tip == 3)
  338.                     {
  339.                         VehInfo[vehid][Neon] = 3;
  340.                         SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari pentru noua achizitie. Te-a costat 100$");
  341.                         GivePlayerMoney(playerid, -100);
  342.                     }
  343.                     else if(tip == 4)
  344.                     {
  345.                         VehInfo[vehid][Neon] = 4;
  346.                         SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari pentru noua achizitie. Te-a costat 100$");
  347.                         GivePlayerMoney(playerid, -100);
  348.                     }
  349.                     else if(tip == 5)
  350.                     {
  351.                         VehInfo[vehid][Neon] = 5;
  352.                         SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari pentru noua achizitie. Te-a costat 100$");
  353.                         GivePlayerMoney(playerid, -100);
  354.                     }
  355.                     else if(tip == 6)
  356.                     {
  357.                         VehInfo[vehid][Neon] = 6;
  358.                         SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari pentru noua achizitie. Te-a costat 100$");
  359.                         GivePlayerMoney(playerid, -100);
  360.                     }
  361.                 }
  362.                 else
  363.                 {
  364.                     SendClientMessage(playerid, 0xFFFFFFFF, "Nu ai destui bani. Iti trebuie 100$");
  365.                 }
  366.             }
  367.             else
  368.             {
  369.                 SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa ai neoanele inchise");
  370.             }
  371.         }
  372.         else
  373.         {
  374.             SendClientMessage(playerid, 0xFFFFFFFF, "Aceasta nu este vehicolul tau");
  375.         }
  376.     }
  377.     else
  378.     {
  379.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii la dealer");
  380.     }
  381.     return 1;
  382. }
  383.  
  384. CMD:vneon(playerid, params[])
  385. {
  386.     new vehid = GetPlayerVehicleID(playerid);
  387.     if(VehInfo[vehid][Neon] >= 1)
  388.     {
  389.         if(neonon[vehid] == 0)
  390.         {
  391.             if(VehInfo[vehid][Neon] == 1)
  392.             {
  393.                 neon[vehid][0] = CreateObject(18647,0,0,0,0,0,0);
  394.                 neon[vehid][1] = CreateObject(18647,0,0,0,0,0,0);
  395.                 neon[vehid][2] = CreateObject(18647,0,0,0,0,0,0);
  396.                 neon[vehid][3] = CreateObject(18647,0,0,0,0,0,0);
  397.                 AttachObjectToVehicle(neon[vehid][0], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  398.                 AttachObjectToVehicle(neon[vehid][1], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  399.                 AttachObjectToVehicle(neon[vehid][2], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  400.                 AttachObjectToVehicle(neon[vehid][3], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  401.                 neonon[vehid] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "Ai aprins neonul");
  402.             }
  403.             else if(VehInfo[vehid][Neon] == 2)
  404.             {
  405.                 neon[vehid][0] = CreateObject(18649,0,0,0,0,0,0);
  406.                 neon[vehid][1] = CreateObject(18649,0,0,0,0,0,0);
  407.                 neon[vehid][2] = CreateObject(18649,0,0,0,0,0,0);
  408.                 neon[vehid][3] = CreateObject(18649,0,0,0,0,0,0);
  409.                 AttachObjectToVehicle(neon[vehid][0], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  410.                 AttachObjectToVehicle(neon[vehid][1], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  411.                 AttachObjectToVehicle(neon[vehid][2], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  412.                 AttachObjectToVehicle(neon[vehid][3], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  413.                 neonon[vehid] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "Ai aprins neonul");
  414.             }
  415.             else if(VehInfo[vehid][Neon] == 3)
  416.             {
  417.                 neon[vehid][0] = CreateObject(18649,0,0,0,0,0,0);
  418.                 neon[vehid][1] = CreateObject(18649,0,0,0,0,0,0);
  419.                 neon[vehid][2] = CreateObject(18652,0,0,0,0,0,0);
  420.                 neon[vehid][3] = CreateObject(18652,0,0,0,0,0,0);
  421.                 AttachObjectToVehicle(neon[vehid][0], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  422.                 AttachObjectToVehicle(neon[vehid][1], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  423.                 AttachObjectToVehicle(neon[vehid][2], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  424.                 AttachObjectToVehicle(neon[vehid][3], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  425.                 neonon[vehid] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "Ai aprins neonul");
  426.             }
  427.             else if(VehInfo[vehid][Neon] == 4)
  428.             {
  429.                 neon[vehid][0] = CreateObject(18648,0,0,0,0,0,0);
  430.                 neon[vehid][1] = CreateObject(18648,0,0,0,0,0,0);
  431.                 neon[vehid][2] = CreateObject(18648,0,0,0,0,0,0);
  432.                 neon[vehid][3] = CreateObject(18648,0,0,0,0,0,0);
  433.                 AttachObjectToVehicle(neon[vehid][0], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  434.                 AttachObjectToVehicle(neon[vehid][1], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  435.                 AttachObjectToVehicle(neon[vehid][2], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  436.                 AttachObjectToVehicle(neon[vehid][3], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  437.                 neonon[vehid] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "Ai aprins neonul");
  438.             }
  439.             else if(VehInfo[vehid][Neon] == 5)
  440.             {
  441.                 neon[vehid][0] = CreateObject(18652,0,0,0,0,0,0);
  442.                 neon[vehid][1] = CreateObject(18652,0,0,0,0,0,0);
  443.                 neon[vehid][2] = CreateObject(18652,0,0,0,0,0,0);
  444.                 neon[vehid][3] = CreateObject(18652,0,0,0,0,0,0);
  445.                 AttachObjectToVehicle(neon[vehid][0], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  446.                 AttachObjectToVehicle(neon[vehid][1], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  447.                 AttachObjectToVehicle(neon[vehid][2], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  448.                 AttachObjectToVehicle(neon[vehid][3], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  449.                 neonon[vehid] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "Ai aprins neonul");
  450.             }
  451.             else if(VehInfo[vehid][Neon] == 6)
  452.             {
  453.                 neon[vehid][0] = CreateObject(18651,0,0,0,0,0,0);
  454.                 neon[vehid][1] = CreateObject(18651,0,0,0,0,0,0);
  455.                 neon[vehid][2] = CreateObject(18651,0,0,0,0,0,0);
  456.                 neon[vehid][3] = CreateObject(18651,0,0,0,0,0,0);
  457.                 AttachObjectToVehicle(neon[vehid][0], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  458.                 AttachObjectToVehicle(neon[vehid][1], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  459.                 AttachObjectToVehicle(neon[vehid][2], vehid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  460.                 AttachObjectToVehicle(neon[vehid][3], vehid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  461.                 neonon[vehid] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "Ai aprins neonul");
  462.             }
  463.         }
  464.         else if(neonon[vehid] == 1)
  465.         {
  466.             DestroyObject(neon[vehid][0]);DestroyObject(neon[vehid][1]);DestroyObject(neon[vehid][2]);DestroyObject(neon[vehid][3]); neonon[vehid] = 0;
  467.             SendClientMessage(playerid, 0xFFFFFFFF, "Ai stint neonul");
  468.         }
  469.     }
  470.     return 1;
  471. }
  472.  
  473. CMD:adestroycar(playerid, params[])
  474. {
  475.     new vehid = GetPlayerVehicleID(playerid);
  476.     new loc = GetPlayerVehicleSeat(playerid);
  477.     new name[MAX_PLAYER_NAME], file[256];
  478.     GetPlayerName(playerid, name, sizeof(name));
  479.     new string[256];
  480.     if(loc == -1)
  481.     {
  482.         if(IsPlayerAdmin(playerid))
  483.         {
  484.             format(string, sizeof(string), " %s a distrus vehiculul %d.",name, vehid);
  485.             SendAdminMesaj(0xFFFFFFFF,string);
  486.             format(file, sizeof(file), "Vehicule/%d.ini", vehid);
  487.             dini_Remove(file);
  488.         }
  489.         else
  490.         {
  491.             SendClientMessage(playerid, 0xFFFFFFFF, "Nu esti admin");
  492.         }
  493.     }
  494.     else
  495.     {
  496.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii soferul");
  497.     }
  498.     return 1;
  499. }
  500.  
  501. CMD:apark(playerid, params[])
  502. {
  503.     new Float:x, Float:y, Float:z, Float:Angle;
  504.     GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, Angle);
  505.     new vehid = GetPlayerVehicleID(playerid);
  506.     new loc = GetPlayerVehicleSeat(playerid);
  507.     if(IsPlayerAdmin(playerid))
  508.     {
  509.         if(IsAnOwnableCar(vehid))
  510.         {
  511.             if(loc == 0)
  512.             {
  513.                 VehInfo[vehid][Locatiex] = x;  VehInfo[vehid][Locatiey] = y; VehInfo[vehid][Locatiez] = z; VehInfo[vehid][Rotatie]= Angle;
  514.                 SetVehiclePos(vehid, x, y, z); SetVehicleZAngle(vehid, Angle); SaveThisCar(vehid);
  515.                 SendClientMessage(playerid, 0xFFFFFFFF, "Ai parcat vehiculul in aceste pozitii. Aici va fi respawnata.");
  516.             }
  517.             else
  518.             {
  519.                 SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii soferul");
  520.             }
  521.         }
  522.         else
  523.         {
  524.             SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii vehicul de vanzare");
  525.         }
  526.  
  527.     }
  528.     else
  529.     {
  530.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii ADMIN RCON");
  531.     }
  532.     return 1;
  533. }
  534.  
  535. CMD:asetpret(playerid, params[])
  536. {
  537.     new vehid = GetPlayerVehicleID(playerid);
  538.     new pret, string[50], name[MAX_PLAYER_NAME];
  539.     GetPlayerName(playerid, name, sizeof(name));
  540.     new loc = GetPlayerVehicleSeat(playerid);
  541.     if(unformat(params, "i", pret))
  542.     {
  543.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /asetpret <pret>");
  544.             return 1;
  545.     }
  546.     if(IsPlayerAdmin(playerid))
  547.     {
  548.         if(IsAnOwnableCar(vehid))
  549.         {
  550.             if(loc == -1)
  551.             {
  552.                 VehInfo[vehid][Valoare] = pret;
  553.                 format(string, sizeof(string), "Ai setat pretul vehiculului la %d",pret);
  554.                 SendClientMessage(playerid, 0xFFFFFFFF, string);
  555.                 format(string, sizeof(string), "%s a setat pretul vehiculului %d la %d",name,vehid,pret);
  556.                 SendAdminMesaj(0xFFFFFFFF,string);
  557.             }
  558.             else
  559.             {
  560.                 SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii soferul");
  561.             }
  562.         }
  563.         else
  564.         {
  565.             SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii vehicul de vanzare");
  566.         }
  567.  
  568.     }
  569.     else
  570.     {
  571.         SendClientMessage(playerid, 0xFFFFFFFF, "Trebuie sa fii ADMIN RCON");
  572.     }
  573.     return 1;
  574. }
  575.  
  576. CMD:setnumar(playerid, params[])
  577. {
  578.     new numar, plate[10];
  579.     new vehid = GetPlayerVehicleID(playerid);
  580.     new name5[MAX_PLAYER_NAME];
  581.     GetPlayerName(playerid, name5, sizeof(name5));
  582.     if(unformat(params, "s[3]", numar))
  583.     {
  584.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /setnumar <litere>(3)");
  585.             return 1;
  586.     }
  587.     if(!(strcmp(VehInfo[vehid][Propietar], name5, true) == 0))
  588.     {
  589.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Vehiculul nu este al tau");
  590.         return 1;
  591.     }
  592.     if(IsAtDealership(playerid))
  593.     {
  594.         format(plate, sizeof(plate), "LS %d %d",vehid,numar);
  595.         SetVehicleNumberPlate(vehid,plate);
  596.         strmid(VehInfo[vehid][Numar], plate, 0, strlen(plate), 999);
  597.     }
  598.     return 1;
  599. }
  600.  
  601. CMD:acreatecar2(playerid, params[])
  602. {
  603.     if(IsPlayerAdmin(playerid))
  604.     {
  605.         ShowModelSelectionMenu(playerid, vehicule, "Create Car by Gireada");
  606.     }
  607.     return 1;
  608. }
  609.  
  610. CMD:acreatecar(playerid, params[])
  611. {
  612.     new string[256], model, valoare, culoare1, culoare2;
  613.     new name[MAX_PLAYER_NAME],string2[256];
  614.     GetPlayerName(playerid, name, sizeof(name));
  615.     if(unformat(params, "iiii", model,valoare,culoare1,culoare2))
  616.     {
  617.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /acreatecar <model> <valoare> <culoare1> <culoare2>");
  618.             return 1;
  619.     }
  620.     if(!(model > 400 && model < 611))
  621.     {
  622.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Modelul trebuie cuprins intre 400 si 600");
  623.         return 1;
  624.     }
  625.     if(!(valoare > 0 && valoare < 5000000))
  626.     {
  627.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Valoarea trebuie cuprins intre 0 si 5000000$");
  628.         return 1;
  629.     }
  630.     if(!(culoare1 > 0 && culoare1 < 255))
  631.     {
  632.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Culoarea trebuie cuprins intre 0 si 255");
  633.         return 1;
  634.     }
  635.     if(!(culoare2 > 0 && culoare2 < 255))
  636.     {
  637.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Culoarea trebuie cuprins intre 0 si 255");
  638.         return 1;
  639.     }
  640.     if(!(IsAtDealership(playerid)))
  641.     {
  642.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa fii la Dealer");
  643.         return 1;
  644.     }
  645.     if(IsPlayerAdmin(playerid))
  646.     {
  647.         if(IsPlayerConnected(playerid))
  648.         {
  649.             new Float:x, Float:y, Float:z;
  650.             GetPlayerPos(playerid, x, y, z);
  651.             new vehicle = CreateVehicle(model,x,y,z,1,culoare1,culoare2,999999);
  652.             PutPlayerInVehicle(playerid,vehicle,0);
  653.             new vehid = GetPlayerVehicleID(playerid);
  654.             format(VehInfo[vehid][Numar], 32 ,"DeVanzare");
  655.             SetVehicleNumberPlate(vehid,VehInfo[vehicle][Numar]);
  656.             strmid(VehInfo[vehid][Numar], "DeVanzare", 0, strlen("DeVanzare"), 999);
  657.             VehInfo[vehid][Locatiex] = x;  VehInfo[vehid][Locatiey] = y; VehInfo[vehid][Locatiez] = z; VehInfo[vehid][Rotatie]= 1;
  658.             VehInfo[vehid][Model] = model; VehInfo[vehid][Valoare] = valoare; VehInfo[vehid][Culoare1] = culoare1; VehInfo[vehid][Culoare2] = culoare2;
  659.             strmid(VehInfo[vehid][Propietar], "Dealer", 0, strlen("Dealer"), 999); VehInfo[vehid][Cumparata] = 0; VehInfo[vehid][Neon] = 0;
  660.             VehInfo[vehid][PaintJob] = 3;
  661.             format(string, sizeof(string), " Vehiculul %d a fost creat cu succes. Felicitari!.", vehicle);
  662.             SendClientMessage(playerid, 0xFFFFFFFF, string);
  663.             format(string, sizeof(string), " %s a creiat vehiculul %d.",name, vehicle);
  664.             SendAdminMesaj(0xFFFFFFFF,string);
  665.             printf("%s a creiat vehiculul %d.",name, vehicle); SaveThisCar(vehicle);
  666.             format(string2, sizeof(string2), " DeVanzare\n Model: %s \n Pret: %d",GetVehicleName(vehid), VehInfo[vehid][Valoare]);
  667.             vtextlabel[vehid] = Create3DTextLabel(string2, 0x7FFF00FF, VehInfo[vehid][Locatiex], VehInfo[vehid][Locatiey], VehInfo[vehid][Locatiez], 20.0, 0, 0);
  668.             Attach3DTextLabelToVehicle( vtextlabel[vehid] , vehid, 0.0, 0.0, 0.0);
  669.         }
  670.         else
  671.         {
  672.             SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa fii conectat.");
  673.             return 1;
  674.         }
  675.     }
  676.     else
  677.     {
  678.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa ai RCON ADMIN");
  679.         return 1;
  680.     }
  681.     return 1;
  682. }
  683.  
  684. CMD:vcumpara(playerid, params[])
  685. {
  686.     new name5[MAX_PLAYER_NAME], vehid = GetPlayerVehicleID(playerid);
  687.     GetPlayerName(playerid, name5, sizeof(name5));
  688.     new string2[256],string[256];
  689.     if(!(IsAtDealership(playerid)))
  690.     {
  691.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa fii la Dealer.");
  692.         return 1;
  693.     }
  694.     if(!(GetPlayerScore(playerid) >= vindelevel))
  695.     {
  696.         format(string,sizeof(string),"[Server-Info] Trebuie sa ai level-ul %d pentru a achizitiona un vehicul",vindelevel);
  697.         SendClientMessage(playerid, 0xFFFFFFFF, string);
  698.         return 1;
  699.     }
  700.     if(IsAnOwnableCar(vehid))
  701.     {
  702.         if(VehInfo[vehid][Cumparata] == 0)
  703.         {
  704.             if(PlayerInfo[playerid][pVehicule] <= maxperscar)
  705.             {
  706.                 if(GetPlayerMoney(playerid) >= VehInfo[vehid][Valoare])
  707.                 {
  708.                     strmid(VehInfo[vehid][Propietar], name5, 0, strlen(name5), 999);
  709.                     VehInfo[vehid][Cumparata] = 1; PlayerInfo[playerid][pVehicule] += 1;
  710.                     GivePlayerMoney(playerid, -VehInfo[vehid][Valoare]);
  711.                     TogglePlayerControllable(playerid, 1); SaveThisCar(vehid);
  712.                     GameTextForPlayer(playerid, "~w~Felicitari~n~Nu uita sa o parchezi cu /v park!", 5000, 3);
  713.                     SendClientMessage(playerid, 0xFFFFFFFF, "Felicitari ti-ai cumparat o masina noua!");
  714.                     format(string2, sizeof(string2), " Propietar: %s \n Model: %s",VehInfo[vehid][Propietar], GetVehicleName(vehid));
  715.                     Update3DTextLabelText(vtextlabel[vehid], 0xFF4500FF, string2);
  716.                 }
  717.                 else
  718.                 {
  719.                     SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Nu ai destui bani, la tine.");
  720.                     return 1;
  721.                 }
  722.             }
  723.             else
  724.             {
  725.                 SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Ai atins limita de vehicule personale");
  726.                 return 1;
  727.             }
  728.         }
  729.         else
  730.         {
  731.             SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Vehiculul este deja cumparat");
  732.             return 1;
  733.         }
  734.     }
  735.     else
  736.     {
  737.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Vehiculul nu este de vanzare");
  738.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Hint] Incearca unul de la dealer");
  739.         return 1;
  740.     }
  741.     return 1;
  742. }
  743.  
  744. CMD:vvinde(playerid, params[])
  745. {
  746.     new name5[MAX_PLAYER_NAME], vehid = GetPlayerVehicleID(playerid), string[256];
  747.     GetPlayerName(playerid, name5, sizeof(name5));
  748.     new string2[256];
  749.     new engine,lights,alarm,doors,bonnet,boot,objective;
  750.     new bani;
  751.     if(!(strcmp(VehInfo[vehid][Propietar], name5, true) == 0))
  752.     {
  753.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Vehiculul nu este al tau");
  754.         return 1;
  755.     }
  756.     if(!(IsAtDealership(playerid)))
  757.     {
  758.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa fii la Dealer.");
  759.         return 1;
  760.     }
  761.     if(!(IsAnOwnableCar(vehid)))
  762.     {
  763.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa fii vehicul de vanzare/");
  764.         return 1;
  765.     }
  766.     strmid(VehInfo[vehid][Propietar], "Dealer", 0, strlen("Dealer"), 999);
  767.     VehInfo[vehid][Cumparata] = 0; PlayerInfo[playerid][pVehicule] -= 1;
  768.     TogglePlayerControllable(playerid, 1); SaveThisCar(vehid);
  769.     bani = VehInfo[vehid][Valoare]%2;
  770.     GivePlayerMoney(playerid, VehInfo[vehid][Valoare]%2);
  771.     GameTextForPlayer(playerid, "~w~Ti-ai vandut vehicululul~n~Nu uita de bani!", 5000, 3);
  772.     format(string, sizeof(string), " Ti-ai vandut vehiculul, ai primit %d $!.", bani);
  773.     SendClientMessage(playerid, 0xFFFFFFFF, string);
  774.     GetVehicleParamsEx(vehid,engine,lights,alarm,doors,bonnet,boot,objective);
  775.     SetVehicleParamsEx(vehid,false,lights,alarm,doors,bonnet,boot,objective);
  776.     VehInfo[vehid][PaintJob] = 3;
  777.     format(string2, sizeof(string2), " DeVanzare\n Model: %s \n Pret: %d",VehInfo[vehid][Propietar], VehInfo[vehid][Valoare]);
  778.     Update3DTextLabelText(vtextlabel[vehid], 0x7FFF00FF, string2);
  779.     return 1;
  780. }
  781.  
  782. CMD:vvindelui(playerid, params[])
  783. {
  784.     new giveplayerid,valoare, vehid = GetPlayerVehicleID(playerid);
  785.     new name5[MAX_PLAYER_NAME], playername[256], giveplayer[256], string[256];
  786.     GetPlayerName(playerid, name5, sizeof(name5));
  787.     if(unformat(params, "ui",giveplayerid,valoare))
  788.     {
  789.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /vvindelui <playerid/name> <valoare> ");
  790.             return 1;
  791.     }
  792.     if(!(GetPlayerScore(giveplayerid) >= vindelevel))
  793.     {
  794.         format(string,sizeof(string),"[Server-Info] Cumparatorul trebuie sa ai level-ul %d pentru a achizitiona un vehicul",vindelevel);
  795.         SendClientMessage(playerid, 0xFFFFFFFF, string);
  796.         format(string,sizeof(string),"[Server-Info] Trebuief trebuie sa ai level-ul %d pentru a achizitiona un vehicul",vindelevel);
  797.         SendClientMessage(giveplayerid, 0xFFFFFFFF, string);
  798.         return 1;
  799.     }
  800.     if(!(strcmp(VehInfo[vehid][Propietar], name5, true) == 0))
  801.     {
  802.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Vehiculul nu este al tau");
  803.         return 1;
  804.     }
  805.     if(!(PlayerInfo[giveplayerid][pVehicule] < maxperscar))
  806.     {
  807.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Persoana a atins limita de vehicule personale");
  808.         return 1;
  809.     }
  810.     GetPlayerName(playerid, playername, sizeof(playername));
  811.     GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
  812.     format(string, sizeof(string), "* I-ai oferit lui %s vehiculul tau pentru $%d .", giveplayer, valoare);
  813.     SendClientMessage(playerid, 0xFFFFFFFF, string);
  814.     format(string, sizeof(string), "* %s ti-a oferit veiculul lui pentru $%d (scrie {1E90FF}/accepta{FFFFFF}) pentru a o cumpara.", playername, valoare);
  815.     SendClientMessage(giveplayerid, 0xFFFFFFFF, string); SaveThisCar(vehid);
  816.     VanzatorVeh[giveplayerid] = playerid;
  817.     IDVehicul[giveplayerid] = vehid;
  818.     PretVehicul[giveplayerid] = valoare;
  819.     SetTimerEx( "VDecizion", 30000, false, "i", giveplayerid);
  820.     return 1;
  821. }
  822.  
  823. CMD:acceptav(playerid, params[])
  824. {
  825.     new string[256], vehid = GetPlayerVehicleID(playerid), name5[MAX_PLAYER_NAME], name6[MAX_PLAYER_NAME];
  826.     GetPlayerName(playerid, name5, sizeof(name5));
  827.     GetPlayerName(VanzatorVeh[playerid], name6, sizeof(name6));
  828.     new string2[256];
  829.     if(VanzatorVeh[playerid] >= 0)
  830.     {
  831.         if(GetPlayerMoney(playerid) >= PretVehicul[playerid])
  832.         {
  833.             GivePlayerMoney(VanzatorVeh[playerid], PretVehicul[playerid]);
  834.             GivePlayerMoney(playerid, -PretVehicul[playerid]);
  835.             format(string, sizeof(string), "* %s ti-a acceptat, ai primit %d.", name5, PretVehicul[playerid]);
  836.             SendClientMessage(VanzatorVeh[playerid], 0xFFFFFFFF, string);
  837.             format(string, sizeof(string), "* %s ti-a vandut vehiculul pentru %d.", name6, PretVehicul[playerid]);
  838.             SendClientMessage(playerid, 0xFFFFFFFF, string);
  839.             strmid(VehInfo[vehid][Propietar], name5, 0, strlen(name5), 999);
  840.             PlayerInfo[playerid][pVehicule] += 1; PlayerInfo[VanzatorVeh[playerid]][pVehicule] -= 1;
  841.             format(string2, sizeof(string2), " Propietar: %s \n Model: %s",VehInfo[vehid][Propietar], GetVehicleName(vehid));
  842.             Update3DTextLabelText(vtextlabel[vehid], 0xFF4500FF, string2);
  843.             VanzatorVeh[playerid] = -1; IDVehicul[playerid] = 0; PretVehicul[playerid] = 0;
  844.         }
  845.         else
  846.         {
  847.             format(string, sizeof(string), "* Nu ai destui bani iti trebuie %d", PretVehicul[playerid]);
  848.             SendClientMessage(playerid, 0xFFFFFFFF, string);
  849.             VanzatorVeh[playerid] = -1;
  850.             IDVehicul[playerid] = 0;
  851.             PretVehicul[playerid] = 0;
  852.  
  853.         }
  854.     }
  855.     else
  856.     {
  857.         SendClientMessage(playerid, 0xFFFFFFFF, "Nu ai nici o oferta");
  858.     }
  859.     return 1;
  860. }
  861.  
  862. CMD:refuzav(playerid, params[])
  863. {
  864.     new string[256], name5[MAX_PLAYER_NAME], name6[MAX_PLAYER_NAME];
  865.     GetPlayerName(playerid, name5, sizeof(name5));
  866.     if(VanzatorVeh[playerid] >= 0)
  867.     {
  868.         if(GetPlayerMoney(playerid) >= PretVehicul[playerid])
  869.         {
  870.             format(string, sizeof(string), "* %s ti-a refuzt oferta.", name5);
  871.             SendClientMessage(VanzatorVeh[playerid], 0xFFFFFFFF, string);
  872.             format(string, sizeof(string), "* % I-ai refuzat oferta lui %s.", name6);
  873.             SendClientMessage(playerid, 0xFFFFFFFF, string);
  874.             VanzatorVeh[playerid] = -1;IDVehicul[playerid] = 0;PretVehicul[playerid] = 0;
  875.         }
  876.     }
  877.     else
  878.     {
  879.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Nu ai nici o oferta, pentru a o refuza.");
  880.         return 1;
  881.     }
  882.     return 1;
  883. }
  884.  
  885. CMD:vpark(playerid, params[])
  886. {
  887.     new Float:x, Float:y, Float:z, Float:Angle, string[26], name5[MAX_PLAYERS];
  888.     GetPlayerPos(playerid, x, y, z);
  889.     GetPlayerFacingAngle(playerid, Angle);
  890.     new vehid = GetPlayerVehicleID(playerid);
  891.     GetPlayerName(playerid, name5, sizeof(name5));
  892.     if(strcmp(VehInfo[vehid][Propietar], name5, true) == 0)
  893.     {
  894.         if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  895.         {
  896.             VehInfo[vehid][Locatiex] = x;  VehInfo[vehid][Locatiey] = y; VehInfo[vehid][Locatiez] = z; VehInfo[vehid][Rotatie]= Angle;
  897.             SetPlayerFacingAngle(playerid, Angle); SetVehiclePos(vehid, x, y, z); SetVehicleZAngle(vehid, Angle);
  898.             SendClientMessage(playerid, 0xFFFFFFFF, "Ai parcat vehiculul in aceste pozitii. Aici va fi respawnata.");
  899.             format(string, sizeof(string), "*  %s si-a parcat vehiculul in aceasta pozitie.", name5);
  900.             ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE); SaveThisCar(vehid);
  901.             return 1;
  902.         }
  903.         else
  904.         {
  905.             SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Nu esti soferul.");
  906.             return 1;
  907.         }
  908.     }
  909.     else
  910.     {
  911.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Nu esti propietarul vehiculului.");
  912.     }
  913.     return 1;
  914. }
  915.  
  916. CMD:vlock(playerid, params[])
  917. {
  918.     new Float:x, Float:y, Float:z;
  919.     GetPlayerPos(playerid, x, y, z);
  920.     new name[MAX_PLAYER_NAME];
  921.     GetPlayerName(playerid, name, sizeof(name));
  922.     new loc = GetPlayerVehicleSeat(playerid);
  923.     if(GetPlayerVehicleSeat(playerid) == -1)
  924.     {
  925.         for(new carid = buyablecars; carid<MAX_VEHICLES; carid++)
  926.         {
  927.             if(GetDistanceToCar(playerid,carid) < 2.0)
  928.             {
  929.                 if(strcmp(VehInfo[carid][Propietar], name, true) == 0)
  930.                 {
  931.                     if(VehInfo[carid][Inchisa] == 0)
  932.                     {
  933.                         VehInfo[carid][Inchisa] = 1;
  934.                         SendClientMessage(playerid, 0xFFFFFFFF, "Ti-ai inchis vehiculul.");break;
  935.                     }
  936.                     else if(VehInfo[carid][Inchisa] == 1)
  937.                     {
  938.                         VehInfo[carid][Inchisa] = 0;
  939.                         SendClientMessage(playerid, 0xFFFFFFFF, "Ti-ai deschis vehiculul.");break;
  940.                     }
  941.                 }
  942.             }
  943.         }
  944.     }
  945.     else if(loc == 0 || loc == 1 || loc == 2 || loc == 3 || loc == 4)
  946.     {
  947.         new vehid = GetPlayerVehicleID(playerid);
  948.         if(strcmp(VehInfo[vehid][Propietar], name, true) == 0)
  949.         {
  950.             if(VehInfo[vehid][Inchisa] == 0)
  951.             {
  952.                 VehInfo[vehid][Inchisa] = 1; SendClientMessage(playerid, 0xFFFFFFFF, "Ti-ai inchis vehiculul.");
  953.                 return 1;
  954.             }
  955.             else if(VehInfo[vehid][Inchisa] == 1)
  956.             {
  957.                 VehInfo[vehid][Inchisa] = 0; SendClientMessage(playerid, 0xFFFFFFFF, "Ti-ai deschis vehiculul.");
  958.                 return 1;
  959.             }
  960.         }
  961.     }
  962.     return 1;
  963. }
  964.  
  965. CMD:mycars(playerid, params[])
  966. {
  967.     new name[MAX_PLAYER_NAME], string[256];
  968.     GetPlayerName(playerid, name, sizeof(name));
  969.     carsshow[playerid] = 0;
  970.     for(new vehid = buyablecars; vehid<sizeof(VehInfo); vehid++)
  971.     {
  972.         if(VehInfo[vehid][Propietar] == name[playerid])
  973.         {
  974.             if(carsshow[playerid] <= PlayerInfo[playerid][pVehicule])
  975.             {
  976.                 new value = VehInfo[vehid][Valoare]%2;
  977.                 new Neontxt[10], Statustxt[10];
  978.                 if(VehInfo[vehid][Neon] >= 1) { Neontxt = "Da"; }
  979.                 else if(VehInfo[vehid][Neon] == 0) { Neontxt = "Nu"; }
  980.                 if(VehInfo[vehid][Inchisa] == 0) { Statustxt = "Nu"; }
  981.                 else if(VehInfo[vehid][Inchisa] == 1) { Statustxt = "Da"; }
  982.                 new kilo = VehInfo[vehid][Km];
  983.                 format(string, sizeof(string), " CarID: %d, Model: %s Valoare: %d, Neon: %s, Inchisa: %s, Kilometrii: %d", vehid, GetVehicleName(vehid), value, Neontxt, Statustxt, kilo);
  984.                 SendClientMessage(playerid, 0xFFFFFFFF, string); carsshow[playerid] += 1;
  985.             }
  986.         }
  987.     }
  988.     carsshow[playerid] = 0;
  989.     return 1;
  990. }
  991.  
  992. CMD:manual(playerid, params[])
  993. {
  994.     new string[1024];
  995.     strcat( string, "         {FF9094}Manual Vehicul\n\n");
  996.     strcat( string, "{7CFC00}/vlock - {FFFAF0}inchizi vehiculul\n");
  997.     strcat( string, "{7CFC00}/vpark - {FFFAF0}parchezi vehiculul \n");
  998.     strcat( string, "{7CFC00}/vvindelui - {FFFAF0}vinzi vehiculul cuiva \n");
  999.     strcat( string, "{7CFC00}/vvinde - {FFFAF0}vinzi vehiculul la dealer \n");
  1000.     strcat( string, "{7CFC00}/vcumpara - {FFFAF0}cumperi vehiculul \n");
  1001.     strcat( string, "{7CFC00}/vneon - {FFFAF0}aprinzi neon-ul \n");
  1002.     strcat( string, "{7CFC00}/cumparaneon - {FFFAF0}cumperi neon\n");
  1003.     strcat( string, "{7CFC00}/mycars - {FFFAF0}vezi vehiculele tale\n\n\n");
  1004.     strcat( string, "{7CFC00}/asellcar - {FFFAF0}vinzi vehiculul (RCON)\n");
  1005.     strcat( string, "{7CFC00}/acreatecar - {FFFAF0}creezi vehiculul (RCON)\n");
  1006.     strcat( string, "{7CFC00}/apark - {FFFAF0}parchezi vehiculul (RCON)\n");
  1007.     strcat( string, "{7CFC00}/asetpret - {FFFAF0}setezi pretul (RCON)\n");
  1008.     strcat( string, "{7CFC00}/rtpv - {FFFAF0}respawnezi vehiculul in care te aflii (RCON)\n");
  1009.     strcat( string, "{7CFC00}/rpv - {FFFAF0}respawnezi vehiculele personale (RCON)\n\n\n");
  1010.     strcat( string, "{7CFC00}/rac - {FFFAF0}respawnezi toate vehiculele (RCON)\n\n\n");
  1011.     strcat( string, "{FFFFFF}Sistemul de vehicule personale creeat de: {FFFAF0}Gireada");
  1012.     ShowPlayerDialog(playerid, 888, DIALOG_STYLE_MSGBOX,"Comenzi",string,"De Acord","");
  1013.     return 1;
  1014. }
  1015.  
  1016. CMD:motor(playerid, params[])
  1017. {
  1018.     new playerState = GetPlayerState(playerid), string[256], vehicleid = GetPlayerVehicleID(playerid), name1[MAX_PLAYERS];
  1019.     new engine,lights,alarm,doors,bonnet,boot,objective;
  1020.     GetPlayerName(playerid, name1, sizeof(name1));
  1021.     GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
  1022.     new name[MAX_PLAYER_NAME];
  1023.     GetPlayerName(playerid, name, sizeof(name));
  1024.     if(!(strcmp(VehInfo[vehicleid][Propietar], name, true) == 0))
  1025.     {
  1026.         SendClientMessage(playerid, 0xFFFFFFFF, "Nu ai cheile acestui vehicul");
  1027.         return 1;
  1028.     }
  1029.     if(playerState == PLAYER_STATE_DRIVER)
  1030.     {
  1031.         if(motoron[vehicleid] == 0)
  1032.         {
  1033.             motoron[vehicleid] = 1;
  1034.             SetVehicleParamsEx(vehicleid,true,lights,alarm,doors,bonnet,boot,objective);
  1035.             format(string, sizeof(string), "* %s invarte cheia si porneste motorul.",name1);
  1036.             ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  1037.             return 1;
  1038.         }
  1039.         else if(motoron[vehicleid] == 1)
  1040.         {
  1041.             motoron[vehicleid] = 0;
  1042.             SetVehicleParamsEx(vehicleid,false,lights,alarm,doors,bonnet,boot,objective);
  1043.             format(string, sizeof(string), "* %s invarte cheia si opreste motorul.",name1);
  1044.             ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
  1045.             return 1;
  1046.         }
  1047.     }
  1048.     return 1;
  1049. }
  1050.  
  1051. stock pName(playerid)
  1052. {
  1053.     new name[MAX_PLAYER_NAME];
  1054.     GetPlayerName(playerid,name,sizeof(name));
  1055.     return name;
  1056. }
  1057.  
  1058. public OnPlayerConnect(playerid)
  1059. {
  1060.     new file[80];
  1061.     format(file, sizeof(file),"JucatoriVehicule/%s.ini", pName(playerid));
  1062.     if(dini_Exists(file))
  1063.     {
  1064.         PlayerInfo[playerid][pVehicule] = dini_Int(file,"Vehicule");
  1065.         PlayerInfo[playerid][pLoggedIn] = dini_Int(file,"Logat");
  1066.        
  1067.     }
  1068.     else if(!dini_Exists(file))
  1069.     {
  1070.         dini_Create(file);
  1071.         dini_IntSet(file,"Vehicule",PlayerInfo[playerid][pVehicule] = 0);
  1072.         dini_IntSet(file,"Logat",PlayerInfo[playerid][pVehicule] = 1);
  1073.     }
  1074.     carsshow[playerid] = 0;
  1075.     return 1;
  1076. }
  1077.  
  1078. public OnPlayerDisconnect(playerid, reason)
  1079. {
  1080.     new file[80];
  1081.     format(file, sizeof(file),"JucatoriVehicule/%s.ini", pName(playerid));
  1082.     dini_IntSet(file,"Vehicule",PlayerInfo[playerid][pVehicule]);
  1083.     PlayerInfo[playerid][pLoggedIn] = 0;
  1084.     return 1;
  1085. }
  1086.  
  1087. public OnPlayerSpawn(playerid)
  1088. {
  1089.     PlayerInfo[playerid][pLoggedIn] = 1;
  1090.     return 1;
  1091. }
  1092.  
  1093. public OnPlayerDeath(playerid, killerid, reason)
  1094. {
  1095.     return 1;
  1096. }
  1097.  
  1098. public OnVehicleSpawn(vehicleid)
  1099. {
  1100.     return 1;
  1101. }
  1102.  
  1103. public OnVehicleDeath(vehicleid, killerid)
  1104. {
  1105.     DestroyObject(neon[vehicleid][0]);DestroyObject(neon[vehicleid][1]);DestroyObject(neon[vehicleid][2]);DestroyObject(neon[vehicleid][3]); neonon[vehicleid] = 0;
  1106.     return 1;
  1107. }
  1108.  
  1109. public OnPlayerText(playerid, text[])
  1110. {
  1111.     return 1;
  1112. }
  1113.  
  1114. public OnPlayerCommandText(playerid, cmdtext[])
  1115. {
  1116.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  1117.     {
  1118.         // Do something here
  1119.         return 1;
  1120.     }
  1121.     return 0;
  1122. }
  1123.  
  1124. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  1125. {
  1126.     new Float:x, Float:y, Float:z;
  1127.     GetPlayerPos(playerid, x, y, z);
  1128.     new name[MAX_PLAYER_NAME];
  1129.     GetPlayerName(playerid, name, sizeof(name));
  1130.     if(VehInfo[vehicleid][Inchisa] == 1 && VehInfo[vehicleid][Propietar] != name[playerid])
  1131.     {
  1132.         SetPlayerPos(playerid,x,y,z);
  1133.         SendClientMessage(playerid, 0xFFFFFFFF, "Acest vehiculul este inchiat");
  1134.     }
  1135.     VerificaKilometri(vehicleid);
  1136.     return 1;
  1137. }
  1138.  
  1139. public OnPlayerExitVehicle(playerid, vehicleid)
  1140. {
  1141.     KillTimer(Contuar[playerid]);
  1142.     return 1;
  1143. }
  1144.  
  1145. public OnPlayerStateChange(playerid, newstate, oldstate)
  1146. {
  1147.     if(newstate == PLAYER_STATE_DRIVER)
  1148.     {
  1149.         Contuar[playerid] = SetTimerEx("VerificaKilometri", 2500, true, "i", GetPlayerVehicleID(playerid));
  1150.     }
  1151.     return 1;
  1152. }
  1153.  
  1154. public OnPlayerEnterCheckpoint(playerid)
  1155. {
  1156.     return 1;
  1157. }
  1158.  
  1159. public OnPlayerLeaveCheckpoint(playerid)
  1160. {
  1161.     return 1;
  1162. }
  1163.  
  1164. public OnPlayerEnterRaceCheckpoint(playerid)
  1165. {
  1166.     return 1;
  1167. }
  1168.  
  1169. public OnPlayerLeaveRaceCheckpoint(playerid)
  1170. {
  1171.     return 1;
  1172. }
  1173.  
  1174. public OnRconCommand(cmd[])
  1175. {
  1176.     return 1;
  1177. }
  1178.  
  1179. public OnPlayerRequestSpawn(playerid)
  1180. {
  1181.     return 1;
  1182. }
  1183.  
  1184. public OnObjectMoved(objectid)
  1185. {
  1186.     return 1;
  1187. }
  1188.  
  1189. public OnPlayerObjectMoved(playerid, objectid)
  1190. {
  1191.     return 1;
  1192. }
  1193.  
  1194. public OnPlayerPickUpPickup(playerid, pickupid)
  1195. {
  1196.     return 1;
  1197. }
  1198.  
  1199. public OnVehicleMod(playerid, vehicleid, componentid)
  1200. {
  1201.     if(GetPlayerInterior(playerid) == 0)
  1202.     {
  1203.         BanEx(playerid, "Tuning Hacks");
  1204.     }
  1205.     return 1;
  1206. }
  1207.  
  1208. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  1209. {
  1210.     /*if(GetPlayerInterior(playerid) == 0)
  1211.     {
  1212.         BanEx(playerid, "Tuning Hacks");
  1213.     }
  1214.     else if(GetPlayerInterior(playerid) == 1)
  1215.     {
  1216.         VehInfo[vehicleid][PaintJob] = paintjobid;
  1217.     }*/
  1218.     return 1;
  1219. }
  1220.  
  1221. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  1222. {
  1223.     return 1;
  1224. }
  1225.  
  1226. public LoadCar()
  1227. {
  1228.     new file[254];
  1229.     new idx = buyablecars;
  1230.     new string2[256];
  1231.     while(idx<sizeof(VehInfo))
  1232.     {
  1233.         format(file, sizeof(file),"Vehicule/%d.ini", idx);
  1234.         if(dini_Exists(file))
  1235.         {
  1236.             VehInfo[idx][Model] = dini_Int(file,"Model");
  1237.             VehInfo[idx][Locatiex] = dini_Float(file,"Locatiex");
  1238.             VehInfo[idx][Locatiey] = dini_Float(file,"Locatiey");
  1239.             VehInfo[idx][Locatiez] = dini_Float(file,"Locatiez");
  1240.             VehInfo[idx][Rotatie] = dini_Float(file,"Rotatie");
  1241.             VehInfo[idx][Valoare] = dini_Int(file,"Valoare");
  1242.             VehInfo[idx][Culoare1] = dini_Int(file,"Culoare1");
  1243.             VehInfo[idx][Culoare2] = dini_Int(file,"Culoare2");
  1244.             strmid(VehInfo[idx][Propietar], dini_Get(file,"Propietar"), 0, strlen(dini_Get(file,"Propietar")), 255);
  1245.             VehInfo[idx][Cumparata] = dini_Int(file,"Cumparata");
  1246.             VehInfo[idx][Inchisa] = dini_Int(file,"Inchisa");
  1247.             VehInfo[idx][Neon] = dini_Int(file,"Neon");
  1248.             strmid(VehInfo[idx][Numar], dini_Get(file,"Numar"), 0, strlen(dini_Get(file,"Numar")), 255);
  1249.             VehInfo[idx][PaintJob] = dini_Int(file,"PaintJob");
  1250. //=============================================================[Spawner]===================================================================
  1251.             new carid = AddStaticVehicle(VehInfo[idx][Model], VehInfo[idx][Locatiex], VehInfo[idx][Locatiey], VehInfo[idx][Locatiez], VehInfo[idx][Rotatie], VehInfo[idx][Culoare1], VehInfo[idx][Culoare2]);
  1252.             SetVehicleNumberPlate(idx, VehInfo[idx][Numar]);
  1253.             ChangeVehiclePaintjob(idx, VehInfo[idx][PaintJob]);
  1254.             idx++;
  1255.             if(VehInfo[carid][Cumparata] == 1)
  1256.             {
  1257.                 format(string2, sizeof(string2), " Model: %s \n Propietar: %s",GetVehicleName(carid),VehInfo[idx][Propietar]);
  1258.                 vtextlabel[carid] = Create3DTextLabel(string2, 0xFF4500FF, VehInfo[carid][Locatiez], VehInfo[carid][Locatiey], VehInfo[carid][Locatiez], 20.0, 0, 0);
  1259.                 Attach3DTextLabelToVehicle(vtextlabel[carid] , carid, 0.0, 0.0, 0.0);
  1260.             }
  1261.             if(VehInfo[idx][Cumparata] == 0)
  1262.             {
  1263.                 format(string2, sizeof(string2), " DeVanzare\n Model: %s \n Pret: %d",GetVehicleName(carid), VehInfo[idx][Valoare]);
  1264.                 vtextlabel[carid] = Create3DTextLabel(string2, 0x7FFF00FF, VehInfo[carid][Locatiex], VehInfo[carid][Locatiey], VehInfo[carid][Locatiez], 20.0, 0, 0);
  1265.                 Attach3DTextLabelToVehicle(vtextlabel[carid] , carid, 0.0, 0.0, 0.0);
  1266.             }
  1267.         }
  1268.         else if(!dini_Exists(file))
  1269.         {
  1270.             idx++;
  1271.         }
  1272.     }
  1273.     printf("Server Stats: Vehicule Personale Incarcate");
  1274.     printf("S-au incarcat %d vehicule personale", idx-buyablecars);
  1275.     return 1;
  1276. }
  1277.  
  1278. public SaveCar()
  1279. {
  1280.     new file2[254];
  1281.     new idx = buyablecars;
  1282.     while(idx<sizeof(VehInfo))
  1283.     {
  1284.         format(file2, sizeof(file2),"Vehicule/%d.ini", idx);
  1285.         if(dini_Exists(file2))
  1286.         {
  1287.             dini_IntSet(file2,"Model",VehInfo[idx][Model]);
  1288.             dini_FloatSet(file2,"Locatiex",VehInfo[idx][Locatiex]);
  1289.             dini_FloatSet(file2,"Locatiey",VehInfo[idx][Locatiey]);
  1290.             dini_FloatSet(file2,"Locatiez",VehInfo[idx][Locatiez]);
  1291.             dini_FloatSet(file2,"Angle",VehInfo[idx][Rotatie]);
  1292.             dini_IntSet(file2,"Valoare",VehInfo[idx][Valoare]);
  1293.             dini_IntSet(file2,"Culoare1",VehInfo[idx][Culoare1]);
  1294.             dini_IntSet(file2,"Culoare2",VehInfo[idx][Culoare2]);
  1295.             dini_Set(file2,"Propietar",VehInfo[idx][Propietar]);
  1296.             dini_IntSet(file2,"Cumparata",VehInfo[idx][Cumparata]);
  1297.             dini_IntSet(file2,"Inchisa",VehInfo[idx][Inchisa]);
  1298.             dini_IntSet(file2,"Neon",VehInfo[idx][Neon]);
  1299.             dini_Set(file2,"Numar",VehInfo[idx][Numar]);
  1300.             SetVehicleNumberPlate(idx,VehInfo[idx][Numar]);
  1301.             dini_IntSet(file2,"PaintJob",VehInfo[idx][PaintJob]);
  1302.             idx++;
  1303.             return 1;
  1304.         }
  1305.         /*else if(!dini_Exists(file2))
  1306.         {
  1307.             dini_Create(file2);
  1308.             dini_IntSet(file2,"Model",VehInfo[idx][Model]);
  1309.             dini_FloatSet(file2,"Locatiex",VehInfo[idx][Locatiex]);
  1310.             dini_FloatSet(file2,"Locatiey",VehInfo[idx][Locatiey]);
  1311.             dini_FloatSet(file2,"Locatiez",VehInfo[idx][Locatiez]);
  1312.             dini_FloatSet(file2,"Angle",VehInfo[idx][Rotatie]);
  1313.             dini_IntSet(file2,"Valoare",VehInfo[idx][Valoare]);
  1314.             dini_IntSet(file2,"Culoare1",VehInfo[idx][Culoare1]);
  1315.             dini_IntSet(file2,"Culoare2",VehInfo[idx][Culoare2]);
  1316.             dini_Set(file2,"Propietar",VehInfo[idx][Propietar]);
  1317.             dini_IntSet(file2,"Cumparata",VehInfo[idx][Cumparata]);
  1318.             dini_IntSet(file2,"Inchisa",VehInfo[idx][Inchisa]);
  1319.             dini_IntSet(file2,"Neon",VehInfo[idx][Neon]);
  1320.             dini_Set(file2,"Numar",VehInfo[idx][Numar]);
  1321.             SetVehicleNumberPlate(idx,VehInfo[idx][Numar]);
  1322.             dini_IntSet(file2,"PaintJob",VehInfo[idx][PaintJob]);
  1323.             idx++;
  1324.             return 1;
  1325.         }*/
  1326.     }
  1327.     return 1;
  1328. }
  1329.  
  1330. public SaveThisCar(vehid)
  1331. {
  1332.     new file2[254];
  1333.     format(file2, sizeof(file2),"Vehicule/%d.ini", vehid);
  1334.     if(dini_Exists(file2))
  1335.     {
  1336.         dini_IntSet(file2,"Model",VehInfo[vehid][Model]);
  1337.         dini_FloatSet(file2,"Locatiex",VehInfo[vehid][Locatiex]);
  1338.         dini_FloatSet(file2,"Locatiey",VehInfo[vehid][Locatiey]);
  1339.         dini_FloatSet(file2,"Locatiez",VehInfo[vehid][Locatiez]);
  1340.         dini_FloatSet(file2,"Angle",VehInfo[vehid][Rotatie]);
  1341.         dini_IntSet(file2,"Valoare",VehInfo[vehid][Valoare]);
  1342.         dini_IntSet(file2,"Culoare1",VehInfo[vehid][Culoare1]);
  1343.         dini_IntSet(file2,"Culoare2",VehInfo[vehid][Culoare2]);
  1344.         dini_Set(file2,"Propietar",VehInfo[vehid][Propietar]);
  1345.         dini_IntSet(file2,"Cumparata",VehInfo[vehid][Cumparata]);
  1346.         dini_IntSet(file2,"Inchisa",VehInfo[vehid][Inchisa]);
  1347.         dini_IntSet(file2,"Neon",VehInfo[vehid][Neon]);
  1348.         dini_Set(file2,"Numar",VehInfo[vehid][Numar]);
  1349.         SetVehicleNumberPlate(vehid,VehInfo[vehid][Numar]);
  1350.         dini_IntSet(file2,"PaintJob",VehInfo[vehid][PaintJob]);
  1351.         return 1;
  1352.     }
  1353.     else if(!dini_Exists(file2))
  1354.     {
  1355.         dini_Create(file2);
  1356.         dini_IntSet(file2,"Model",VehInfo[vehid][Model]);
  1357.         dini_FloatSet(file2,"Locatiex",VehInfo[vehid][Locatiex]);
  1358.         dini_FloatSet(file2,"Locatiey",VehInfo[vehid][Locatiey]);
  1359.         dini_FloatSet(file2,"Locatiez",VehInfo[vehid][Locatiez]);
  1360.         dini_FloatSet(file2,"Angle",VehInfo[vehid][Rotatie]);
  1361.         dini_IntSet(file2,"Valoare",VehInfo[vehid][Valoare]);
  1362.         dini_IntSet(file2,"Culoare1",VehInfo[vehid][Culoare1]);
  1363.         dini_IntSet(file2,"Culoare2",VehInfo[vehid][Culoare2]);
  1364.         dini_Set(file2,"Propietar",VehInfo[vehid][Propietar]);
  1365.         dini_IntSet(file2,"Cumparata",VehInfo[vehid][Cumparata]);
  1366.         dini_IntSet(file2,"Inchisa",VehInfo[vehid][Inchisa]);
  1367.         dini_IntSet(file2,"Neon",VehInfo[vehid][Neon]);
  1368.         dini_Set(file2,"Numar",VehInfo[vehid][Numar]);
  1369.         SetVehicleNumberPlate(vehid,VehInfo[vehid][Numar]);
  1370.         dini_IntSet(file2,"PaintJob",VehInfo[vehid][PaintJob]);
  1371.         return 1;
  1372.     }
  1373.     return 1;
  1374. }
  1375.  
  1376. public SendAdminMesaj(color,const string[])
  1377. {
  1378.     for(new i = 0; i < MAX_PLAYERS; i++)
  1379.     {
  1380.         if(IsPlayerConnected(i))
  1381.         {
  1382.             if(IsPlayerAdmin(i))
  1383.             {
  1384.                 SendClientMessage(i, color, string);
  1385.                 printf("%s", string);
  1386.             }
  1387.         }
  1388.     }
  1389.     return 1;
  1390. }
  1391.  
  1392. public VerificaKilometri(vehicleid)
  1393. {
  1394.     if(GetVehicleSpeed(vehicleid) > 10)
  1395.     {
  1396.         Metrii[vehicleid] += floatround(floatdiv(GetVehicleSpeed(vehicleid), 60.0));
  1397.     }
  1398.     if(Metrii[vehicleid] > 9)
  1399.     {
  1400.         VehInfo[vehicleid][Km] += 1;
  1401.         Metrii[vehicleid] = 0;
  1402.     }
  1403.     return 1;
  1404. }
  1405.  
  1406. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  1407. {
  1408.     new string[256], name[MAX_PLAYER_NAME],string2[500];
  1409.     GetPlayerName(playerid, name, sizeof(name));
  1410.     if(response)
  1411.     {
  1412.         switch(dialogid)
  1413.         {
  1414.             case Dialog_Manual:
  1415.             {
  1416.                 SendClientMessage(playerid, 0xFFFFFFFFF, " Speram ca te-ai lamurit");
  1417.             }
  1418.             case Dialog_Pret:
  1419.             {
  1420.                 if(!(IsNumeric(inputtext)))
  1421.                 {
  1422.                     format(string,sizeof(string), "{FFFFFF}Introdu pretul vehiculului. Model: %s ", VehicleNames[vehicul[playerid]-400]);
  1423.                     ShowPlayerDialog(playerid, Dialog_Pret, DIALOG_STYLE_INPUT,"Pret Vehicul",string,"->","Anuleaza");
  1424.                 }
  1425.                 vehiculpret[playerid] = strval(inputtext);
  1426.                 format(string,sizeof(string), "{FFFFFF}Introdu culoarea 1. Model: %s ", VehicleNames[vehicul[playerid]-400]);
  1427.                 ShowPlayerDialog(playerid, Dialog_Culoare1, DIALOG_STYLE_INPUT,"Culoare Vehicul",string,"->","Anuleaza");
  1428.             }
  1429.             case Dialog_Culoare1:
  1430.             {
  1431.                 if(!(strval(inputtext) >= 0 || strval(inputtext) <= 254))
  1432.                 {
  1433.                     format(string,sizeof(string), "{FFFFFF}Introdu culoarea 1(Intre 0 si 254). Model: %s ", VehicleNames[vehicul[playerid]-400]);
  1434.                     ShowPlayerDialog(playerid, Dialog_Culoare1, DIALOG_STYLE_INPUT,"Culoare Vehicul",string,"->","Anuleaza");
  1435.                 }
  1436.                 vehiculculoare1[playerid] = strval(inputtext);
  1437.                 format(string,sizeof(string), "{FFFFFF}Introdu culoarea 2. Model: %s ", VehicleNames[vehicul[playerid]-400]);
  1438.                 ShowPlayerDialog(playerid, Dialog_Culoare2, DIALOG_STYLE_INPUT,"Culoare Vehicul",string,"->","Anuleaza");
  1439.             }
  1440.             case Dialog_Culoare2:
  1441.             {
  1442.                 if(!(strval(inputtext) >= 0 || strval(inputtext) <= 254))
  1443.                 {
  1444.                     format(string,sizeof(string), "{FFFFFF}Introdu culoarea 2(Intre 0 si 254). Model: %s ", VehicleNames[vehicul[playerid]-400]);
  1445.                     ShowPlayerDialog(playerid, Dialog_Culoare2, DIALOG_STYLE_INPUT,"Culoare Vehicul",string,"->","Anuleaza");
  1446.                 }
  1447.                 vehiculculoare2[playerid] = strval(inputtext);
  1448.                 new Float:x, Float:y, Float:z;
  1449.                 GetPlayerPos(playerid, x, y, z);
  1450.                 new vehicle = CreateVehicle(vehicul[playerid],x,y,z,1,vehiculculoare1[playerid],vehiculculoare2[playerid],999999);
  1451.                 PutPlayerInVehicle(playerid,vehicle,0);
  1452.                 new vehid = GetPlayerVehicleID(playerid);
  1453.                 format(VehInfo[vehid][Numar], 32 ,"DeVanzare");
  1454.                 SetVehicleNumberPlate(vehid,VehInfo[vehicle][Numar]);
  1455.                 strmid(VehInfo[vehid][Numar], "DeVanzare", 0, strlen("DeVanzare"), 999);
  1456.                 VehInfo[vehid][Locatiex] = x;  VehInfo[vehid][Locatiey] = y; VehInfo[vehid][Locatiez] = z; VehInfo[vehid][Rotatie]= 1;
  1457.                 VehInfo[vehid][Model] = vehicul[playerid]; VehInfo[vehid][Valoare] = vehiculpret[playerid]; VehInfo[vehid][Culoare1] = vehiculculoare1[playerid]; VehInfo[vehid][Culoare2] = vehiculculoare2[playerid];
  1458.                 strmid(VehInfo[vehid][Propietar], "Dealer", 0, strlen("Dealer"), 999); VehInfo[vehid][Cumparata] = 0; VehInfo[vehid][Neon] = 0;
  1459.                 VehInfo[vehid][PaintJob] = 3;
  1460.                 format(string, sizeof(string), " Vehiculul %d a fost creat cu succes. Felicitari!.", vehicle);
  1461.                 SendClientMessage(playerid, 0xFFFFFFFF, string);
  1462.                 format(string, sizeof(string), " %s a creiat vehiculul %d.",name, vehicle);
  1463.                 SendAdminMesaj(0xFFFFFFFF,string);
  1464.                 printf("%s a creiat vehiculul %d.",name, vehicle); SaveThisCar(vehicle);
  1465.                 format(string2, sizeof(string2), " DeVanzare\n Model: %s \n Pret: %d",GetVehicleName(vehid), VehInfo[vehid][Valoare]);
  1466.                 vtextlabel[vehid] = Create3DTextLabel(string2, 0x7FFF00FF, VehInfo[vehid][Locatiex], VehInfo[vehid][Locatiey], VehInfo[vehid][Locatiez], 20.0, 0, 0);
  1467.                 Attach3DTextLabelToVehicle( vtextlabel[vehid] , vehid, 0.0, 0.0, 0.0);
  1468.             }
  1469.         }
  1470.         return 1;
  1471.     }
  1472.     return 0;
  1473. }
  1474.  
  1475. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  1476. {
  1477.     if(IsPlayerConnected(playerid))
  1478.     {
  1479.         new Float:posx, Float:posy, Float:posz;
  1480.         new Float:oldposx, Float:oldposy, Float:oldposz;
  1481.         new Float:tempposx, Float:tempposy, Float:tempposz;
  1482.         GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  1483.         for(new i = 0; i < MAX_PLAYERS; i++)
  1484.         {
  1485.             if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  1486.             {
  1487.                 GetPlayerPos(i, posx, posy, posz);
  1488.                 tempposx = (oldposx -posx);
  1489.                 tempposy = (oldposy -posy);
  1490.                 tempposz = (oldposz -posz);
  1491.                 if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16))) // If the player is within 16 meters
  1492.                 {
  1493.                     SendClientMessage(i, col1, string);
  1494.                 }
  1495.                 else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8))) // within 8 meters
  1496.                 {
  1497.                     SendClientMessage(i, col2, string);
  1498.                 }
  1499.                 else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4))) //4 meters
  1500.                 {
  1501.                     SendClientMessage(i, col3, string);
  1502.                 }
  1503.                 else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2))) //2 meters
  1504.                 {
  1505.                     SendClientMessage(i, col4, string);
  1506.                 }
  1507.                 else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) //1 meter
  1508.                 {
  1509.                     SendClientMessage(i, col5, string);
  1510.                 }
  1511.             }
  1512.             else
  1513.             {
  1514.                 SendClientMessage(i, col1, string);
  1515.             }
  1516.         }
  1517.     }
  1518.     return 1;
  1519. }
  1520.  
  1521. stock GetDistanceToCar(playerid,carid)
  1522. {
  1523.     new Float:dis;
  1524.     new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
  1525.     if (!IsPlayerConnected(playerid)) {
  1526.     return -1;
  1527.     }
  1528.     GetPlayerPos(playerid,x1,y1,z1);
  1529.     if(!IsVehicleInUse(carid)){
  1530.         GetVehiclePos(carid,x2,y2,z2);
  1531.         dis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
  1532.         return floatround(dis);
  1533.     }else{
  1534.         return 1;
  1535.     }
  1536. }
  1537.  
  1538. stock IsVehicleInUse(vehicleid)
  1539. {
  1540.     for(new i; i != MAX_PLAYERS; i++)
  1541.     {
  1542.         if(GetPlayerVehicleID(i) == vehicleid)
  1543.         {
  1544.             return i;
  1545.         }
  1546.     }
  1547.     return INVALID_PLAYER_ID;
  1548. }
  1549.  
  1550.  
  1551. stock GetVehicleName(vehicleid)
  1552. {
  1553.     new String[256];
  1554.     format(String,sizeof(String),"%s",VehicleNames[GetVehicleModel(vehicleid) - 400]);
  1555.     return String;
  1556. }
  1557.  
  1558. stock IsVehicleOccupied(vehicleid)
  1559. {
  1560.     for(new i=0;i<MAX_PLAYERS;i++)
  1561.     {
  1562.         if(IsPlayerInAnyVehicle(i))
  1563.         {
  1564.             if(GetPlayerVehicleID(i)==vehicleid)
  1565.             {
  1566.                 return 1;
  1567.             }
  1568.             else
  1569.             {
  1570.                 return 0;
  1571.             }
  1572.         }
  1573.     }
  1574.     return 1;
  1575. }
  1576.  
  1577. stock GetVehicleSpeed( vehicleid )
  1578. {
  1579.         new Float:vSpeed[3];
  1580.         GetVehicleVelocity( vehicleid, vSpeed[0], vSpeed[1], vSpeed[2] );
  1581.         new Float:vSpeed_Float;
  1582.         vSpeed_Float = floatsqroot( ((vSpeed[0] * vSpeed[0]) + (vSpeed[1] * vSpeed[1])) + (vSpeed[2] * vSpeed[2])) * 161;
  1583.         new vSpeed_Int;
  1584.         vSpeed_Int = floatround( vSpeed_Float, floatround_round);
  1585.         return vSpeed_Int;
  1586.  
  1587. }
  1588.  
  1589. public OnPlayerModelSelection(playerid, response, listid, modelid)
  1590. {
  1591.     new string[256];
  1592.     if(listid == vehicule)
  1593.     {
  1594.         if(response)
  1595.         {
  1596.             vehicul[playerid] = modelid;
  1597.             format(string,sizeof(string), "{FFFFFF}Introdu pretul vehiculului. Model: %s ", VehicleNames[modelid-400]);
  1598.             ShowPlayerDialog(playerid, Dialog_Pret, DIALOG_STYLE_INPUT,"Pret Vehicul",string,"->","Anuleaza");
  1599.         }
  1600.         else SendClientMessage(playerid, 0xFF0000FF, "Altadata");
  1601.         return 1;
  1602.  
  1603.     }
  1604.     return 1;
  1605. }
  1606.  
  1607. IsNumeric(const string[])
  1608. {
  1609.     for (new i = 0, j = strlen(string); i < j; i++)
  1610.     {
  1611.         if (string[i] > '9' || string[i] < '0') return 0;
  1612.     }
  1613.     return 1;
  1614. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement