Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// by Junior_Djjr
// You need: https://forum.mixmods.com.br/f16-utilidades/t179-gta3script-while-true-return_true-e-return_false
SCRIPT_START
{
LVAR_INT scplayer playerId char taskChar i
LVAR_FLOAT f x y z x2 y2 z2
LVAR_TEXT_LABEL16 animName
playerId = 0
GET_PLAYER_CHAR playerId scplayer
WHILE TRUE
WAIT 0
//IF IS_2PLAYER_GAME_GOING_ON
GOSUB Process
//ENDIF
ENDWHILE
Process:
IF IS_BUTTON_PRESSED playerId 11
IF NOT IS_CHAR_IN_ANY_CAR scplayer
IF GET_CHAR_PLAYER_IS_TARGETING playerId char
IF NOT IS_CHAR_IN_ANY_CAR char
AND NOT IS_CHAR_DEAD char
IF CLEO_CALL IsCharDoingTask 0 (char 907) //TASK_COMPLEX_SEEK_ENTITY
RETURN
ENDIF
IF CLEO_CALL IsCharDoingTask 0 (char 1000) //TASK_COMPLEX_KILL_PED_ON_FOOT
RETURN
ENDIF
GET_PED_TYPE char i
IF i = 8
OR i < 2
TASK_GOTO_CHAR_OFFSET char scplayer 3000 0.7 0.0
REQUEST_ANIMATION GANGS
timera = 0
WHILE TRUE
WAIT 0
IF IS_CHAR_DEAD char
OR IS_CHAR_DEAD scplayer
OR timera > 3000
REMOVE_ANIMATION "GANGS"
RETURN
ENDIF
IF LOCATE_CHAR_ANY_MEANS_CHAR_3D char scplayer 1.2 1.2 1.0 FALSE
BREAK
ENDIF
ENDWHILE
TASK_TURN_CHAR_TO_FACE_CHAR char scplayer
TASK_TURN_CHAR_TO_FACE_CHAR scplayer char
timera = 0
WHILE TRUE
WAIT 0
IF IS_CHAR_DEAD char
OR IS_CHAR_DEAD scplayer
OR timera > 3000
REMOVE_ANIMATION "GANGS"
RETURN
ENDIF
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS char 0.0 1.0 0.0 x y z
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer 0.0 1.0 0.0 x2 y2 z2
IF LOCATE_CHAR_ANY_MEANS_3D scplayer x y z 0.5 0.5 0.5 FALSE
AND LOCATE_CHAR_ANY_MEANS_3D char x2 y2 z2 0.5 0.5 0.5 FALSE
BREAK
ENDIF
ENDWHILE
GENERATE_RANDOM_INT_IN_RANGE 0 7 i
SWITCH i
CASE 0
animname = "hndshkaa"
BREAK
CASE 1
animname = "hndshkba"
BREAK
CASE 3
animname = "hndshkca"
BREAK
CASE 4
animname = "hndshkda"
BREAK
CASE 5
animname = "hndshkaa"
// they are fat
IF IS_CHAR_MODEL char FAM1
GET_FLOAT_STAT 21 f
IF IS_CHAR_MODEL scplayer FAM1
OR f > 500.0
animname = "hndshkea"
ENDIF
ENDIF
BREAK
CASE 6
animname = "hndshkfa"
BREAK
ENDSWITCH
// if IFP not loaded yet
IF NOT HAS_ANIMATION_LOADED "GANGS"
LOAD_ALL_MODELS_NOW
ENDIF
TASK_PLAY_ANIM char $animname "gangs" 4.0 FALSE FALSE FALSE FALSE -1
timera = 0
WHILE TRUE
WAIT 0
IF IS_CHAR_DEAD char
OR IS_CHAR_DEAD scplayer
OR timera > 1000
REMOVE_ANIMATION "GANGS"
RETURN
ENDIF
IF IS_CHAR_PLAYING_ANIM char $animname
BREAK
ENDIF
ENDWHILE
TASK_PLAY_ANIM scplayer $animname "gangs" 4.0 FALSE FALSE FALSE FALSE -1
WAIT 3000
REMOVE_ANIMATION "GANGS"
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
RETURN
Release:
REMOVE_ANIMATION "GANGS"
RETURN
}
SCRIPT_END
{
LVAR_INT char taskId // In
LVAR_INT i
IsCharDoingTask:
//task = (uintptr_t)ped->m_pIntelligence->m_TaskMgr.FindActiveTaskByType(TASK_COMPLEX_KILL_PED_ON_FOOT);
GET_PED_POINTER char i
i += 0x47C //m_pIntelligence
READ_MEMORY i 4 FALSE (i)
i += 0x4 //m_TaskMgr
CALL_METHOD_RETURN 0x681740 i 1 0 (taskId)(i)
IS_THING_GREATER_THAN_THING i 0
CLEO_RETURN 0
}
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.