Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SCRIPT_START
{
LVAR_INT mode // In
LVAR_INT car // In
LVAR_INT ini_explode // In
LVAR_FLOAT min_size max_size fire_radius // In
LVAR_INT scplayer
LVAR_INT ihealth p i intensity delay fire create_fire wait_fire fires explode_car subclass
LVAR_FLOAT x y z angle size
CONST_INT FIRE_TIME_LIMIT 10000
CONST_INT DROP_IDLE_TIME 20000
CONST_INT DROP_INTENSITY 140
// Vehicle model SubClass
CONST_INT VEHICLE_AUTOMOBILE 0
CONST_INT VEHICLE_MTRUCK 1
CONST_INT VEHICLE_QUAD 2
CONST_INT VEHICLE_HELI 3
CONST_INT VEHICLE_PLANE 4
CONST_INT VEHICLE_BOAT 5
CONST_INT VEHICLE_TRAIN 6
CONST_INT VEHICLE_FHELI 7
CONST_INT VEHICLE_FPLANE 8
CONST_INT VEHICLE_BIKE 9
CONST_INT VEHICLE_BMX 10
CONST_INT VEHICLE_TRAILER 11
IF mode = 1
GOTO drop
ENDIF
///////////////////////////////////////////////////////////////////////////////////////////////////
IF READ_INT_FROM_INI_FILE "cleo\Oil Leaking.ini" "Fire" "ExplodeCar" ini_explode
AND READ_FLOAT_FROM_INI_FILE "cleo\Oil Leaking.ini" "Fire" "Radius" fire_radius
AND READ_FLOAT_FROM_INI_FILE "cleo\Oil Leaking.ini" "OilPool" "MinSize" min_size
AND READ_FLOAT_FROM_INI_FILE "cleo\Oil Leaking.ini" "OilPool" "MaxSize" max_size
ELSE
PRINT_STRING_NOW "~r~Error:~s~ Fail to load 'Oil Leaking.ini'" 7000
TERMINATE_THIS_CUSTOM_SCRIPT
ENDIF
activate_loop:
WAIT 0
// For all vehicles
READ_MEMORY 0xB74494 4 0 (p)
p += 0x04
READ_MEMORY p 4 0 (p)
i = 0
WHILE i <= 27904
READ_MEMORY p 1 0 (car)
p++
IF car >= 0x00
AND car < 0x80
car += i
/////////////////////////////////////////
GET_VEHICLE_POINTER car subclass
subclass += 0x594 // mSubClass
READ_MEMORY subclass 4 FALSE subclass
IF subclass = VEHICLE_AUTOMOBILE
OR subclass = VEHICLE_MTRUCK
OR subclass = VEHICLE_QUAD
OR subclass = VEHICLE_BIKE
GET_CAR_HEALTH car ihealth
IF ihealth < 500
AND NOT IS_CAR_DEAD car
STREAM_CUSTOM_SCRIPT "Oil Leaking (Junior_Djjr).cs" (1 car ini_explode min_size max_size fire_radius)
delay = ihealth - 100
IF delay < 100
delay = 100
ENDIF
WAIT delay // this will also delay another vehicles, but this is good for game limits
ENDIF
ENDIF
/////////////////////////////////////////
ENDIF
i += 256
ENDWHILE
GOTO activate_loop
///////////////////////////////////////////////////////////////////////////////////////////////////
drop:
CLEO_CALL GetDummyPos 0 (car 7/*DUMMY_Engine*/) (x y z)
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS car (x y z) (x y z)
GENERATE_RANDOM_FLOAT_IN_RANGE 0.0 360.0 (angle)
GENERATE_RANDOM_FLOAT_IN_RANGE min_size max_size (size)
timerb = FIRE_TIME_LIMIT
intensity = DROP_INTENSITY
timera = 0
WHILE timera < DROP_IDLE_TIME
WAIT 0
GOSUB apply_fire
DRAW_SHADOW 6 (x y z) angle size intensity (0 0 0)
ENDWHILE
WHILE intensity > 0
timera = 0
WHILE timera < 100
WAIT 0
IF intensity > 50
GOSUB apply_fire
ENDIF
DRAW_SHADOW 6 (x y z) angle size intensity (0 0 0)
ENDWHILE
intensity -= 2
ENDWHILE
TERMINATE_THIS_CUSTOM_SCRIPT
apply_fire:
GET_NUMBER_OF_FIRES_IN_RANGE x y z fire_radius (fires)
IF fires > 0
IF create_fire = FALSE
AND timerb > FIRE_TIME_LIMIT
timerb = 0
create_fire = TRUE
ENDIF
ENDIF
IF create_fire = TRUE
IF timerb > 100
GET_NUMBER_OF_FIRES_IN_RANGE x y z 0.2 (i)
IF i = 0
START_SCRIPT_FIRE x y z 0 1 (fire)
ENDIF
create_fire = FALSE
wait_fire = TRUE
IF fires > 0
AND ini_explode = TRUE
IF DOES_VEHICLE_EXIST car
IF LOCATE_CAR_3D car x y z fire_radius fire_radius fire_radius FALSE
explode_car = TRUE
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
IF wait_fire = TRUE
IF timerb > 300
CLEAR_ALL_SCRIPT_FIRE_FLAGS
wait_fire = FALSE
ENDIF
ENDIF
IF explode_car = TRUE
IF timerb > 1000
IF DOES_VEHICLE_EXIST car
IF NOT IS_CAR_DEAD car
EXPLODE_CAR car
explode_car = FALSE
ENDIF
ENDIF
ENDIF
ENDIF
RETURN
}
{
LVAR_INT car // In
LVAR_INT dummy // In
LVAR_INT model p
LVAR_FLOAT x y z
GetDummyPos:
GET_CAR_MODEL car model
CALL_FUNCTION_RETURN 0x00403DA0 /*getModelPtr*/ 1 1 (model) (p)
p += 0x5C // pvehiclestruct
READ_MEMORY p 4 FALSE p
dummy *= 12
p += dummy
READ_MEMORY p 4 FALSE (x)
p += 4
READ_MEMORY p 4 FALSE (y)
p += 4
READ_MEMORY p 4 FALSE (z)
CLEO_RETURN 0 (x y z)
}
SCRIPT_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.