Instantly share code, notes, and snippets.

Embed
What would you like to do?
SCRIPT_START
{
LVAR_INT scplayer intensity finalIntensity damage
LVAR_FLOAT fDamage fDamageMultiplier fIntensity
GET_PLAYER_CHAR 0 scplayer
IF NOT READ_INT_FROM_INI_FILE "cleo\Shot Cam Shake.ini" "Settings" "Intensity" (intensity)
intensity = 20
ENDIF
IF NOT READ_FLOAT_FROM_INI_FILE "cleo\Shot Cam Shake.ini" "Settings" "DamageMultiplier" (fDamageMultiplier)
fDamageMultiplier = 1.0
ENDIF
WHILE TRUE
WAIT 0
IF CLEO_CALL IsCharFiring 0 (scplayer)()
IF CLEO_CALL IsCharHoldingDangerousWeapon 0 (scplayer)()
IF NOT fDamageMultiplier > 0.0
CLEO_CALL GetCurrentWeaponDamage 0 (scplayer)(damage)
fDamage =# damage
fDamage /= 40.0
fDamage *= fDamageMultiplier
fIntensity =# intensity
fIntensity *= fDamage
finalIntensity =# fIntensity
ELSE
finalIntensity = intensity
ENDIF
SHAKE_CAM finalIntensity
ENDIF
ENDIF
ENDWHILE
}
SCRIPT_END
{
/*
Get the current weapon damage from char - By Junior_Djjr
Use: CLEO_CALL GetCurrentWeaponDamage 0 (hChar)(fDamage)
*/
LVAR_INT hChar // In
LVAR_INT iWeaponType pWeaponInfo damage
GetCurrentWeaponDamage:
GET_CURRENT_CHAR_WEAPON hChar (iWeaponType)
// GetWeaponInfo (we can ignore skill (1) here)
CALL_FUNCTION_RETURN 0x743C60 2 2 (1 iWeaponType)(pWeaponInfo)
pWeaponInfo += 0x22
READ_MEMORY pWeaponInfo 2 FALSE (damage)
CLEO_RETURN 0 (damage)
}
{
/*
Return true if char is holding any fire or explosion weapon - By Junior_Djjr
Use: IF CLEO_CALL IsCharHoldingDangerousWeapon 0 (hChar)()
*/
LVAR_INT hChar // In
LVAR_INT iWeaponType pWeaponInfo iFireType
CONST_INT WEAPON_FIRE_MELEE 0
CONST_INT WEAPON_FIRE_INSTANT_HIT 1
CONST_INT WEAPON_FIRE_PROJECTILE 2
CONST_INT WEAPON_FIRE_AREA_EFFECT 3
CONST_INT WEAPON_FIRE_CAMERA 4
CONST_INT WEAPON_FIRE_USE 5
IsCharHoldingDangerousWeapon:
GET_CURRENT_CHAR_WEAPON hChar (iWeaponType)
// GetWeaponInfo (we can ignore skill (1) here)
CALL_FUNCTION_RETURN 0x743C60 2 2 (1 iWeaponType)(pWeaponInfo)
READ_MEMORY pWeaponInfo 4 FALSE (iFireType)
IF iFireType = WEAPON_FIRE_INSTANT_HIT
//OR iFireType = WEAPON_FIRE_PROJECTILE
RETURN_TRUE
ELSE
RETURN_FALSE
ENDIF
CLEO_RETURN 0 ()
}
{
/*
Return true if char is firing any weapon - By Junior_Djjr
Use: IF CLEO_CALL IsCharFiring 0 (char)()
Compatible with IF AND/OR
*/
LVAR_INT char // In
LVAR_INT pChar offset weaponData state
IsCharFiring:
GET_PED_POINTER char (pChar)
offset = pChar + 0x718 // Current Weapon Slot
READ_MEMORY offset 1 FALSE (offset)
weaponData = pChar + 0x5A0 // Start of weapon data (28 bytes)
offset *= 28
offset += 0x4 // m_nState
weaponData += offset
READ_MEMORY weaponData 4 FALSE (state)
IS_THING_EQUAL_TO_THING state 1
CLEO_RETURN 0 ()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment