Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@JuniorDjjr
Last active January 5, 2024 17:38
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/1f02baf540c5c9978039e126d704ed4f to your computer and use it in GitHub Desktop.
Save JuniorDjjr/1f02baf540c5c9978039e126d704ed4f to your computer and use it in GitHub Desktop.
// by Junior_Djjr - MixMods.com.br
// You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus
SCRIPT_START
{
LVAR_INT scplayer pTask i iLastMove j iCurrentMove bHit pColPoint pEntity pPos iSurfaceA iSurfaceB pNormal pPlayer iWeaponType pGetWeaponHighestParentType iMetalMeleeSurface iWoodMeleeSurface
LVAR_FLOAT x y z x2 y2 z2
CONST_INT TIME_TO_PLAY 320 // TODO: use combo hit value
GET_PLAYER_CHAR 0 scplayer
IF GET_LOADED_LIBRARY "$fastman92limitAdjuster.asi" pGetWeaponHighestParentType
GET_DYNAMIC_LIBRARY_PROCEDURE "GetWeaponHighestParentType" pGetWeaponHighestParentType pGetWeaponHighestParentType
ENDIF
IF READ_INT_FROM_INI_FILE "CLEO\Melee Hit Sound.ini" "Settings" "MetalMeleeSurface" (iMetalMeleeSurface)
AND iMetalMeleeSurface > -1
ELSE
iMetalMeleeSurface = 52
ENDIF
IF READ_INT_FROM_INI_FILE "CLEO\Melee Hit Sound.ini" "Settings" "WoodMeleeSurface" (iWoodMeleeSurface)
AND iWoodMeleeSurface > -1
ELSE
iWoodMeleeSurface = 169
ENDIF
WHILE TRUE
WAIT 0
IF IS_CHAR_FIGHTING scplayer // for performance
IF GET_CHAR_TASK_POINTER_BY_ID scplayer TASK_SIMPLE_FIGHT (pTask)
READ_STRUCT_OFFSET pTask 0x25 1 (i)
READ_STRUCT_OFFSET pTask 0x27 1 (j)
IF j = 11
WHILE j = 11
WAIT 0
IF GET_CHAR_TASK_POINTER_BY_ID scplayer TASK_SIMPLE_FIGHT (pTask)
READ_STRUCT_OFFSET pTask 0x25 1 (iCurrentMove)
READ_STRUCT_OFFSET pTask 0x27 1 (j)
IF NOT iCurrentMove = iLastMove
timera = 0
bHit = FALSE
ENDIF
IF timera > TIME_TO_PLAY
AND bHit = FALSE
GOSUB ProcessHit
bHit = TRUE
ENDIF
iLastMove = iCurrentMove
ELSE
BREAK
ENDIF
ENDWHILE
ENDIF
ENDIF
ENDIF
iLastMove = -1
timera = 0
ENDWHILE
ProcessHit:
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer 0.0 0.0 0.0 x y z
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer 0.0 1.0 0.0 x2 y2 z2
GET_LABEL_POINTER ColPointBuffer pColPoint
IF GET_COLLISION_BETWEEN_POINTS x y z x2 y2 z2 TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE -1 pColPoint x y z pEntity
//PRINT_FORMATTED_NOW "PAH! %d" 100 iSound
READ_STRUCT_OFFSET pColPoint 0x20 1 (iSurfaceA)
READ_STRUCT_OFFSET pColPoint 0x23 1 (iSurfaceB)
IF iSurfaceB >= 50
AND iSurfaceB <= 65
GOSUB SetTweak
ELSE
SWITCH iSurfaceB
CASE 0
CASE 1
CASE 2
CASE 3
CASE 4
CASE 5
CASE 7
CASE 8
CASE 34
CASE 165
CASE 18
CASE 35
CASE 36
CASE 37
CASE 162
CASE 164
CASE 167
CASE 168
CASE 171
GOSUB SetTweak
BREAK
ENDSWITCH
ENDIF
pNormal = pColPoint + 0x10
GET_PED_POINTER scplayer pPlayer
// CAudioEngine::ReportCollision( &AudioEngine, &pThis->physical.entity, &pEntity->physical.entity, v153, v152, pColPoint, v85, vecTheDirection.x, 1.0, 0, 0);
CALL_METHOD 0x506EB0 0xB6BC90 10 0 (0 1 1.0 1.0 pNormal pColPoint iSurfaceB iSurfaceA pEntity pPlayer)()
ENDIF
RETURN
SetTweak:
GET_CURRENT_CHAR_WEAPON scplayer iWeaponType
IF pGetWeaponHighestParentType > 0
CALL_FUNCTION_RETURN pGetWeaponHighestParentType 1 1 (iWeaponType)(i)
IF i > 0
iWeaponType = i
ENDIF
ENDIF
IF iWeaponType = WEAPONTYPE_GOLFCLUB
OR iWeaponType = WEAPONTYPE_SHOVEL
OR iWeaponType = WEAPONTYPE_CHAINSAW
OR iWeaponType = WEAPONTYPE_KATANA
OR iWeaponType = WEAPONTYPE_KNIFE
iSurfaceA = iMetalMeleeSurface
iSurfaceB = iMetalMeleeSurface
ENDIF
IF iWeaponType = WEAPONTYPE_BASEBALLBAT
OR iWeaponType = WEAPONTYPE_CANE
OR iWeaponType = WEAPONTYPE_POOL_CUE
iSurfaceA = iWoodMeleeSurface
iSurfaceB = iWoodMeleeSurface
ENDIF
RETURN
}
SCRIPT_END
ColPointBuffer:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ENDDUMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment