Advertisement
Gireada

Personal Vehicles

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