Skip to content

Instantly share code, notes, and snippets.

@JuniorDjjr
Last active January 5, 2024 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JuniorDjjr/7979cd8fc737a76b3cf8f6b3805f506a to your computer and use it in GitHub Desktop.
Save JuniorDjjr/7979cd8fc737a76b3cf8f6b3805f506a to your computer and use it in GitHub Desktop.
//You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus
SCRIPT_START
{
LVAR_INT scplayer hVeh hVehUsing iProgress iAlarm hCop i pVeh iPlayerId
LVAR_FLOAT fLastCollisionIntensity f
GET_PLAYER_CHAR 0 (scplayer)
MAKE_NOP 0x6E1DBC 8 //KeepLightEngineOff from MixSets
SET_SCRIPT_EVENT_CAR_WEAPON_DAMAGE ON OnCarWeaponDamage hVeh
WHILE TRUE
WAIT 0
iPlayerId = 0
GOSUB ProcessPlayer
IF IS_2PLAYER_GAME_GOING_ON
iPlayerId = 1
GOSUB ProcessPlayer
ENDIF
ENDWHILE
ProcessPlayer:
GET_PLAYER_CHAR iPlayerId (scplayer)
GET_CAR_CHAR_IS_USING scplayer (hVehUsing)
iProgress = 0
WHILE GET_ANY_CAR_NO_SAVE_RECURSIVE iProgress (iProgress hVeh)
GET_CAR_ALARM hVeh (iAlarm)
IF iAlarm = CAR_ALARM_ON
GET_CAR_COLLISION_INTENSITY hVeh (fLastCollisionIntensity)
IF fLastCollisionIntensity > 2.0
GOSUB PlayAlarm
ELSE
IF HAS_CAR_BEEN_DAMAGED_BY_CHAR hVeh scplayer
CLEAR_CAR_LAST_DAMAGE_ENTITY hVeh
GOSUB PlayAlarm
ELSE
GET_CAR_CHAR_IS_USING scplayer hVehUsing
IF hVeh = hVehUsing
AND IS_CHAR_DOING_TASK_ID scplayer TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE
GOSUB PlayAlarm
ENDIF
ENDIF
ENDIF
ENDIF
ENDWHILE
RETURN
OnCarWeaponDamage:
GET_CAR_ALARM hVeh (iAlarm)
IF iAlarm = CAR_ALARM_ON
GOSUB PlayAlarm
ENDIF
RETURN_SCRIPT_EVENT
PlayAlarm:
SET_CAR_ALARM hVeh CAR_ALARM_PLAYING
IF NOT IS_WANTED_LEVEL_GREATER iPlayerId 0
IF GET_CLOSEST_COP_NEAR_CHAR scplayer 50.0 TRUE TRUE TRUE TRUE (hCop)
ALTER_WANTED_LEVEL_NO_DROP iPlayerId 1
ENDIF
ENDIF
RETURN
}
SCRIPT_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment