Advertisement
Nyft_

public OnVehicleTakeDamage ~Nyft

Sep 18th, 2021 (edited)
726
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3.     * SISTEMA DE BATIDA PARA DEMONSTRAR A PUBLIC:
  4.         -> https://pastebin.com/mBvviuNf
  5.  
  6. */
  7.  
  8. enum E_VEHICLE_DATA
  9. {
  10.     // bool:E_VEHICLE_BROKEN,
  11.  
  12.     Float:E_VEHICLE_NEW_HEALTH,
  13.     Float:E_VEHICLE_OLD_HEALTH
  14. };
  15.  
  16. new vehicle[MAX_VEHICLES][E_VEHICLE_DATA];
  17.  
  18. // -----------------------------------------------------------------------------
  19.  
  20. forward OnVehicleTakeDamage(vehicleid, playerid, Float:newhealth, Float:oldhealth);
  21.  
  22. // -----------------------------------------------------------------------------
  23.  
  24. public OnPlayerUpdate(playerid)
  25. {
  26.     new vehicleid;
  27.  
  28.     if((vehicleid = GetPlayerVehicleID(playerid)) != 0 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  29.     {
  30.         GetVehicleHealth(vehicleid, vehicle[vehicleid][E_VEHICLE_NEW_HEALTH]);
  31.  
  32.         if(vehicle[vehicleid][E_VEHICLE_NEW_HEALTH] != vehicle[vehicleid][E_VEHICLE_OLD_HEALTH]) {
  33.             CallLocalFunction("OnVehicleTakeDamage", "iiff", vehicleid, playerid, vehicle[vehicleid][E_VEHICLE_NEW_HEALTH], vehicle[vehicleid][E_VEHICLE_OLD_HEALTH]);
  34.             vehicle[vehicleid][E_VEHICLE_OLD_HEALTH] = vehicle[vehicleid][E_VEHICLE_NEW_HEALTH];
  35.         }
  36.     }
  37.     return 1;
  38. }
  39.  
  40. // -----------------------------------------------------------------------------
  41.  
  42. public OnVehicleTakeDamage(vehicleid, playerid, Float:newhealth, Float:oldhealth)
  43. {
  44.     printf("VEÍCULO-ID: %i / JOGADOR-ID: %i / DANO ANTIGO: %.1f / DANO NOVO: %.1f", vehicleid, playerid, oldhealth, newhealth);
  45.     return 1;
  46. }
Advertisement
RAW Paste Data Copied
Advertisement