Advertisement
Gireada

Vehicule Pers v3

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