k2bi_YT

Untitled

Apr 15th, 2022
1,250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 12.21 KB | None | 0 0
  1. //Isso deve ser adicionado no topo do GM, ele salvara todas as informações do veiculo, você pode alterar conforme sua necessidade
  2.  
  3. #define Hook%0(%1)  stock%0_k2(%1)
  4.  
  5. Hook AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2)
  6. {
  7.     TotalCarros++;
  8.     new vehicleid = AddStaticVehicle(modelid, spawn_x, spawn_y, spawn_z, z_angle, color1, color2);
  9.     VehicleInfo[vehicleid][VehModelo] = modelid;
  10.     VehicleInfo[vehicleid][VehCor1] = color1;
  11.     VehicleInfo[vehicleid][VehCor2] = color2;
  12.     VehicleInfo[vehicleid][VehX] = spawn_x;
  13.     VehicleInfo[vehicleid][VehY] = spawn_y;
  14.     VehicleInfo[vehicleid][VehZ] = spawn_z;
  15.     VehicleInfo[vehicleid][VehR] = z_angle;
  16.     VehicleInfo[vehicleid][VehMultas] = 0;
  17.     VehicleInfo[vehicleid][VehPaintJob] = 3;
  18.     new str[128];
  19.     format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
  20.     Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
  21.     format(VehicleInfo[vehicleid][VehPlaca], MAX_PLAYER_NAME, str);
  22.     format(VehicleInfo[vehicleid][VehDono], 25, "Server");
  23.     SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
  24.     for(new i = 0; i < 14; ++i)
  25.     {
  26.         RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
  27.     }
  28.     ChangeVehiclePaintjob(vehicleid, 3);
  29.     switch(GetVehicleModel(vehicleid))
  30.     {
  31.         case 432: SetVehicleHealth(vehicleid, 10000);//rhino
  32.         case 427: SetVehicleHealth(vehicleid, 1500);//enforce
  33.         case 490: SetVehicleHealth(vehicleid, 4000);//FBI rancher
  34.         case 528: SetVehicleHealth(vehicleid, 4500);//FBI truck
  35.         case 601: SetVehicleHealth(vehicleid, 4500);//S.W.A.T
  36.         case 470: SetVehicleHealth(vehicleid, 4000);//PATRIOT
  37.         case 428: SetVehicleHealth(vehicleid, 4500);//Securicar
  38.     }
  39.     return vehicleid;
  40. }
  41. Hook AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, addsiren=0)
  42. {
  43.     TotalCarros++;
  44.     new vehicleid = AddStaticVehicleEx(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, color1, color2, respawn_delay, addsiren=0);
  45.     VehicleInfo[vehicleid][VehModelo] = modelid;
  46.     VehicleInfo[vehicleid][VehCor1] = color1;
  47.     VehicleInfo[vehicleid][VehCor2] = color2;
  48.     VehicleInfo[vehicleid][VehX] = spawn_x;
  49.     VehicleInfo[vehicleid][VehY] = spawn_y;
  50.     VehicleInfo[vehicleid][VehZ] = spawn_z;
  51.     VehicleInfo[vehicleid][VehR] = z_angle;
  52.     VehicleInfo[vehicleid][VehMultas] = 0;
  53.     VehicleInfo[vehicleid][VehPaintJob] = 3;
  54.     new str[10];
  55.     format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
  56.     Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
  57.     format(VehicleInfo[vehicleid][VehPlaca], 10, str);
  58.     format(VehicleInfo[vehicleid][VehDono], 25, "Server");
  59.     SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
  60.     for(new i = 0; i < 14; ++i)
  61.     {
  62.         RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
  63.     }
  64.     ChangeVehiclePaintjob(vehicleid, 3);
  65.     switch(GetVehicleModel(vehicleid))
  66.     {
  67.         case 432: SetVehicleHealth(vehicleid, 10000);//rhino
  68.         case 427: SetVehicleHealth(vehicleid, 1500);//enforce
  69.         case 490: SetVehicleHealth(vehicleid, 4000);//FBI rancher
  70.         case 528: SetVehicleHealth(vehicleid, 4500);//FBI truck
  71.         case 601: SetVehicleHealth(vehicleid, 4500);//S.W.A.T
  72.         case 470: SetVehicleHealth(vehicleid, 4000);//PATRIOT
  73.         case 428: SetVehicleHealth(vehicleid, 4500);//Securicar
  74.     }
  75.     return vehicleid;
  76. }
  77. Hook CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0)
  78. {
  79.     TotalCarros++;
  80.     new vehicleid = CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0);
  81.     VehicleInfo[vehicleid][VehModelo] = vehicletype;
  82.     VehicleInfo[vehicleid][VehCor1] = color1;
  83.     VehicleInfo[vehicleid][VehCor2] = color2;
  84.     VehicleInfo[vehicleid][VehX] = x;
  85.     VehicleInfo[vehicleid][VehY] = y;
  86.     VehicleInfo[vehicleid][VehZ] = z;
  87.     VehicleInfo[vehicleid][VehMultas] = 0;
  88.     VehicleInfo[vehicleid][VehR] = rotation;
  89.     VehicleInfo[vehicleid][VehPaintJob] = 3;
  90.     new str[10];
  91.     format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
  92.     Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
  93.     format(VehicleInfo[vehicleid][VehPlaca], 10, str);
  94.     format(VehicleInfo[vehicleid][VehDono], 25, "Server");
  95.     SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
  96.     for(new i = 0; i < 14; ++i)
  97.     {
  98.         RemoveVehicleComponent(vehicleid, GetVehicleComponentInSlot(vehicleid, i));
  99.     }
  100.     ChangeVehiclePaintjob(vehicleid, 3);
  101.     switch(GetVehicleModel(vehicleid))
  102.     {
  103.         case 432: SetVehicleHealth(vehicleid, 10000);//rhino
  104.         case 427: SetVehicleHealth(vehicleid, 1500);//enforce
  105.         case 490: SetVehicleHealth(vehicleid, 4000);//FBI rancher
  106.         case 528: SetVehicleHealth(vehicleid, 4500);//FBI truck
  107.         case 601: SetVehicleHealth(vehicleid, 4500);//S.W.A.T
  108.         case 470: SetVehicleHealth(vehicleid, 4000);//PATRIOT
  109.         case 428: SetVehicleHealth(vehicleid, 4500);//Securicar
  110.     }
  111.     return vehicleid;
  112. }
  113.  
  114. #undef AddStaticVehicleEx
  115. #undef AddStaticVehicle
  116. #undef CreateVehicle
  117.  
  118. #define AddStaticVehicle            AddStaticVehicle_k2
  119. #define AddStaticVehicleEx          AddStaticVehicleEx_k2
  120. #define CreateVehicle               CreateVehicle_k2
  121.  
  122. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  123. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  124. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  125. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  126.  
  127.  
  128.  
  129.  
  130. //Aqui é as unfirmações que todos os veiculos irá ter, isso pode ser evitado para hack de tunagem de carros, etc...
  131. //Não é necessario usar todas essas informações, isso vai de sua necessidade
  132. enum vInfo
  133. {
  134.     Float:VehX,
  135.     Float:VehY,
  136.     Float:VehZ,
  137.     Float:VehR,
  138.     Float:VehLataria,
  139.     VehEstacionado,
  140.     VehPreco,
  141.     VehMod[MAX_MODS],
  142.     VehPaintJob,
  143.     VehModelo,
  144.     VehCor1,
  145.     VehCor2,
  146.     VehCombustivel,
  147.     VehDono[MAX_PLAYER_NAME],
  148.     VehValorVenda,
  149.     VehPlaca[25],
  150.     VehPreso,
  151.     VehMultas,
  152.     bool:VehOrg,
  153.     Text3D:Label
  154. };
  155. new VehicleInfo[MAX_VEHICLES][vInfo];
  156.  
  157.  
  158.  
  159. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  160. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  161. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  162. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  163.  
  164.  
  165.  
  166. //Aqui será o modelo de salvamento dos veiculos das organizações, como eu uso DOF2, será salvo nesse modelo
  167. SalvarVeiculosOrgs()
  168. {
  169.     new str[500], string[800], file[64];
  170.     for(new i; i < MAX_ORG; ++i)
  171.     {
  172.         format(file, 64, /*O CAMINHO DA PASTA DAS ORGANIZAÇÕES*/, i);
  173.         for(new vehicleid = 0, maxveh = GetVehiclePoolSize(); vehicleid <= maxveh; ++vehicleid)
  174.         {
  175.             if(!strcmp(InfoOrg[i][Nome], VehicleInfo[vehicleid][VehDono]))
  176.             {
  177.                 format(str, sizeof(str), "VehOrg_%d", veh);
  178.                 format(string, sizeof(string), "%d|%d|%d|%d|%d|%f|%f|%f|%f|%s",
  179.                 VehicleInfo[vehicleid][VehModelo],
  180.                 VehicleInfo[vehicleid][VehCor1],
  181.                 VehicleInfo[vehicleid][VehCor2],
  182.                 VehicleInfo[vehicleid][VehPreso],
  183.                 VehicleInfo[vehicleid][VehMultas],
  184.                 VehicleInfo[vehicleid][VehX],
  185.                 VehicleInfo[vehicleid][VehY],
  186.                 VehicleInfo[vehicleid][VehZ],
  187.                 VehicleInfo[vehicleid][VehR],
  188.                 VehicleInfo[vehicleid][VehPlaca]);
  189.                 DOF2_SetString(file, str, string);
  190.                 DestroyVehicle(vehicleid);
  191.             }
  192.         }
  193.     }
  194.     return true;
  195. }
  196.  
  197.  
  198. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  199. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  200. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  201. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  202.  
  203.  
  204. CarregarVehOrgs()
  205. {
  206.     new file[64], str[256], key[256], string[11][256];
  207.     for(new i; i < MAX_ORG; ++i)
  208.     {
  209.         format(file, 64, /*O CAMINHO DA PASTA DAS ORGANIZAÇÕES*/, i);
  210.         for(new veh = 0; veh < MAX_VEHORGS; ++veh)
  211.         {
  212.             format(key, sizeof(key), "VehOrg_%d", veh);
  213.             format(str, sizeof(str), DOF2_GetString(file, key));
  214.             split(str, string, '|');
  215.             if(strval(string[0]))
  216.             {
  217.                 new vehicleid = INVALID_VEHICLE_ID;
  218.                 vehicleid = AddStaticVehicleEx(
  219.                 strval(string[0]),
  220.                 floatstr(string[5]),
  221.                 floatstr(string[6]),
  222.                 floatstr(string[7]),
  223.                 floatstr(string[8]),
  224.                 strval(string[1]),
  225.                 strval(string[2]),
  226.                 -1);
  227.                 VehicleInfo[vehicleid][VehModelo] = strval(string[0]);
  228.                 VehicleInfo[vehicleid][VehCor1] = strval(string[1]);
  229.                 VehicleInfo[vehicleid][VehCor2] = strval(string[2]);
  230.                 VehicleInfo[vehicleid][VehPreso] = strval(string[3]);
  231.                 VehicleInfo[vehicleid][VehMultas] = strval(string[4]);
  232.                 VehicleInfo[vehicleid][VehX] = floatstr(string[5]);
  233.                 VehicleInfo[vehicleid][VehY] = floatstr(string[6]);
  234.                 VehicleInfo[vehicleid][VehZ] = floatstr(string[7]);
  235.                 VehicleInfo[vehicleid][VehR] = floatstr(string[8]);
  236.                 if(strlen(string[9]) < 6)
  237.                 {
  238.                     format(str, sizeof(str), "%c%c%c%i%c%i%i", Random_Maiuscula(),Random_Maiuscula(),Random_Maiuscula(),
  239.                     Random_Numero(),Random_Maiuscula(),Random_Numero(), Random_Numero());
  240.                     format(VehicleInfo[vehicleid][VehPlaca], MAX_PLAYER_NAME, str);
  241.                 }
  242.                 else
  243.                 {
  244.                     format(VehicleInfo[vehicleid][VehPlaca], MAX_PLAYER_NAME, string[9]);
  245.                 }
  246.                 format(VehicleInfo[vehicleid][VehDono], 25, NomeOrg(i));
  247.                 VehicleInfo[vehicleid][VehOrg] = true;
  248.                 SetVehicleNumberPlate(vehicleid, VehicleInfo[vehicleid][VehPlaca]);
  249.                 if(VehicleInfo[vehicleid][VehPreso])
  250.                 {
  251.                     FixVehicleDetra(vehicleid);
  252.                 }
  253.             }
  254.         }
  255.     }
  256.     return true;
  257. }
  258.  
  259. stock split(const strsrc[], const strdest[][], delimiter)
  260. {
  261.     new i, li;
  262.     new aNum;
  263.     new len;
  264.     while(i <= strlen(strsrc))
  265.     {
  266.         if(strsrc[i]==delimiter || i==strlen(strsrc))
  267.         {
  268.             len = strmid(strdest[aNum], strsrc, li, i, 128);
  269.             strdest[aNum][len] = 0;
  270.             li = i+1;
  271.             aNum++;
  272.         }
  273.         i++;
  274.     }
  275.     return true;
  276. }
Advertisement
Add Comment
Please, Sign In to add comment