Guest User

Carregar e Salvar veiculo

a guest
Sep 18th, 2022
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.73 KB | Gaming | 0 0
  1. SalvarVeiculo(playerid)
  2. {
  3.     if(IsValidVehicle(CarDono[playerid]))
  4.     {
  5.         // Pegar informações
  6.         static model, color1, color2;
  7.         model = GetVehicleModel(CarDono[playerid]);
  8.         GetVehicleColor(CarDono[playerid], color1, color2);
  9.  
  10.         static Float:x, Float:y, Float:z, Float:r;
  11.         GetVehiclePos(CarDono[playerid], x, y, z);
  12.         GetVehicleZAngle(CarDono[playerid], r);
  13.  
  14.         static Float:health;
  15.         GetVehicleHealth(CarDono[playerid], health);
  16.  
  17.         // Salvar informações
  18.         DOF2_SetInt(PathCarro(playerid), "Model", model);
  19.         DOF2_SetInt(PathCarro(playerid), "Cor1", color1);
  20.         DOF2_SetInt(PathCarro(playerid), "Cor2", color2);
  21.         DOF2_SetFloat(PathCarro(playerid), "PosX", x);
  22.         DOF2_SetFloat(PathCarro(playerid), "PosY", y);
  23.         DOF2_SetFloat(PathCarro(playerid), "PosZ", z);
  24.         DOF2_SetFloat(PathCarro(playerid), "PosR", r);
  25.         DOF2_SetFloat(PathCarro(playerid), "Health", health);
  26.         DOF2_SetFloat(PathCarro(playerid), "Armour", armour);
  27.         DOF2_SaveFile();
  28.     }
  29. }
  30.  
  31. CarregarVeiculo(playerid)
  32. {
  33.     if(DOF2_FileExists(PathCarro(playerid)))
  34.     {
  35.         // Carregar Dados
  36.         static model, color1, color2;
  37.         model = DOF2_GetInt(PathCarro(playerid), "Model");
  38.         color1 = DOF2_GetInt(PathCarro(playerid), "Cor1");
  39.         color2 = DOF2_GetInt(PathCarro(playerid), "Cor2");
  40.        
  41.         static Float:x, Float:y, Float:z, Float:r;
  42.         x = DOF2_GetFloat(PathCarro(playerid), "PosX");
  43.         y = DOF2_GetFloat(PathCarro(playerid), "PosY");
  44.         z = DOF2_GetFloat(PathCarro(playerid), "PosZ");
  45.         r = DOF2_GetFloat(PathCarro(playerid), "PosR");
  46.        
  47.         static Float:health;
  48.         health = DOF2_GetFloat(PathCarro(playerid), "Health");
  49.        
  50.         // Spawnar Veiculo
  51.         CarDono[playerid] = AddStaticVehicle(model, x, y, z, r, color1, color2);
  52.         SetVehicleHealth(CarDono[playerid], health);
  53.     }
  54. }
  55.  
  56.  
  57.  
Advertisement
Add Comment
Please, Sign In to add comment