Last active
January 5, 2024 17:46
-
-
Save JuniorDjjr/443ad3fbb7c5f64e50dec6f956a5c1d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// by Junior_Djjr | |
// You need: https://forum.mixmods.com.br/f16-utilidades/t179-gta3script-while-true-return_true-e-return_false | |
// And also: https://www.mixmods.com.br/2020/03/CLEOPlus.html | |
SCRIPT_START | |
{ | |
LVAR_INT scplayer char timer time isBleeding i j iProgress iDamageType | |
LVAR_FLOAT x y z f | |
CONST_INT HEALTH_TO_BLEED 50 | |
// Extended vars constants, to make it easier to read | |
CONST_INT VAR_TIME_TO_STOP_BLEED 1 | |
CONST_INT VAR_TIME_TO_PAUSE_OR_UNPAUSE_BLEED 2 | |
CONST_INT VAR_BLEED_ENABLED 3 | |
CONST_INT TOTAL_EXTENDED_VARS 3 | |
///////////////////////////////////////////// | |
WAIT 0 | |
WAIT 0 | |
GET_PLAYER_CHAR 0 scplayer | |
WHILE TRUE | |
WAIT 0 | |
GET_GAME_TIMER timer | |
// Process random chars | |
iProgress = 0 | |
WHILE GET_ANY_CHAR_NO_SAVE_RECURSIVE iProgress (iProgress char) | |
GOSUB ProcessChar | |
ENDWHILE | |
// Process also players | |
char = scplayer | |
GOSUB ProcessChar | |
IF IS_2PLAYER_GAME_GOING_ON | |
GET_PLAYER_CHAR 1 char | |
GOSUB ProcessChar | |
ENDIF | |
ENDWHILE | |
///////////////////////////////////////////// | |
ProcessChar: | |
// Check if var 1 is initialized | |
IF GET_EXTENDED_CHAR_VAR char AUTO VAR_TIME_TO_STOP_BLEED time | |
// If initialized, check the values | |
IF NOT time = 0 // not stopped yet | |
IF timer > time // current time is greater than stop time | |
GOSUB DisableBleed | |
ELSE | |
GET_EXTENDED_CHAR_VAR char AUTO VAR_TIME_TO_PAUSE_OR_UNPAUSE_BLEED time | |
IF timer > time // current time is greater than pause/unpause time | |
// Pause or unpause based on current state | |
GET_EXTENDED_CHAR_VAR char AUTO VAR_BLEED_ENABLED isBleeding | |
IF isBleeding = TRUE | |
GOSUB PauseBleed | |
ELSE | |
GOSUB UnpauseBleed | |
ENDIF | |
ENDIF | |
ENDIF | |
ELSE | |
// Initialized, processed, and stopped. Check to enable it again. | |
IF NOT IS_CHAR_DEAD char // don't enable it again if dead | |
GET_EXTENDED_CHAR_VAR char AUTO VAR_BLEED_ENABLED isBleeding | |
IF isBleeding = -1 // Unable (already processed, disabled last time) | |
IF IS_CHAR_HEALTH_GREATER char HEALTH_TO_BLEED | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_BLEED_ENABLED 0 // ok, we can enable it again when the health goes low back again | |
ENDIF | |
ELSE | |
// We can enable it again, so check it | |
IF NOT IS_CHAR_HEALTH_GREATER char HEALTH_TO_BLEED | |
GOSUB EnableBleed | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDIF | |
ELSE | |
// If not initialized, check if is valid to initialize | |
IF NOT IS_CHAR_DEAD char | |
IF NOT IS_CHAR_HEALTH_GREATER char HEALTH_TO_BLEED | |
GET_CHAR_DAMAGE_LAST_FRAME char j iDamageType j f | |
IF IS_WEAPON_FIRE_TYPE iDamageType WEAPONFIRE_INSTANT_HIT | |
OR IS_WEAPON_FIRE_TYPE iDamageType WEAPONFIRE_MELEE | |
OR IS_WEAPON_FIRE_TYPE iDamageType WEAPONFIRE_PROJECTILE | |
IF NOT iDamageType = WEAPONTYPE_TEARGAS | |
AND NOT iDamageType = WEAPONTYPE_MOLOTOV | |
// Initialize, and then set the value | |
INIT_EXTENDED_CHAR_VARS char AUTO TOTAL_EXTENDED_VARS | |
GOSUB EnableBleed | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDIF | |
RETURN | |
PauseBleed: | |
GENERATE_RANDOM_INT_IN_RANGE 700 1000 i | |
time = timer + i // Time to unpause | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_TIME_TO_PAUSE_OR_UNPAUSE_BLEED time | |
SET_CHAR_BLEEDING char OFF | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_BLEED_ENABLED 0 | |
RETURN | |
StartBleed: | |
UnpauseBleed: | |
GENERATE_RANDOM_INT_IN_RANGE 0 200 i | |
time = timer + i // Time to pause | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_TIME_TO_PAUSE_OR_UNPAUSE_BLEED time | |
SET_CHAR_BLEEDING char ON | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_BLEED_ENABLED 1 | |
RETURN | |
EnableBleed: | |
SET_CHAR_BLEEDING char ON | |
GENERATE_RANDOM_INT_IN_RANGE 4000 8000 i | |
time = timer + i // Time to stop | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_TIME_TO_STOP_BLEED time | |
GOSUB StartBleed | |
RETURN | |
DisableBleed: | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_TIME_TO_STOP_BLEED 0 // disabled | |
SET_EXTENDED_CHAR_VAR char AUTO VAR_BLEED_ENABLED -1 // unable to enable again (wait for the health increase again) | |
SET_CHAR_BLEEDING char OFF | |
RETURN | |
} | |
SCRIPT_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment