Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SCRIPT_START
{
LVAR_INT scplayer hChar pChar hObj hLastObject i hTasks
LVAR_FLOAT x y z charX charY charZ objX objY objZ
GET_PLAYER_CHAR 0 scplayer
WHILE TRUE
WAIT 100
GET_ACTIVE_CAMERA_COORDINATES x y z
IF GET_RANDOM_CHAR_IN_SPHERE_NO_SAVE_RECURSIVE x y z 300.0 FALSE TRUE hChar
WAIT 0 // THIS ISN'T RECOMMENDED, but in this case we don't need to be accurated, so it's ok for a little performance
IF GOSUB GetObject
GOSUB Process
CONTINUE
ENDIF
WHILE GET_RANDOM_CHAR_IN_SPHERE_NO_SAVE_RECURSIVE x y z 300.0 TRUE TRUE hChar
WAIT 0
IF GOSUB GetObject
GOSUB Process
BREAK
ENDIF
ENDWHILE
ENDIF
ENDWHILE
Process:
IF GET_EXTENDED_CHAR_VAR hChar AUTO 1 hLastObject
IF hLastObject = hObj
RETURN
ENDIF
ELSE
INIT_EXTENDED_CHAR_VARS hChar AUTO 1
ENDIF
SET_EXTENDED_CHAR_VAR hChar AUTO 1 hObj
IF IS_CHAR_DEAD hChar
RETURN
ENDIF
GET_OBJECT_COORDINATES hObj objX objY objZ
TASK_GO_TO_COORD_ANY_MEANS hChar objX objY objZ 4 -1
REQUEST_ANIMATION BOMBER
timera = 0
WHILE TRUE
WAIT 0
IF IS_CHAR_DEAD hChar
OR timera > 8000
RETURN
ENDIF
IF LOCATE_CHAR_ANY_MEANS_3D hChar objX objY objZ 1.25 1.25 1.0 FALSE
BREAK
ENDIF
ENDWHILE
WHILE NOT HAS_ANIMATION_LOADED BOMBER
WAIT 0
ENDWHILE
IF IS_CHAR_DEAD hChar
RETURN
ENDIF
timera = 0
WHILE timera < 1000
WAIT 50
IF IS_CHAR_DEAD hChar
RETURN
ENDIF
TASK_TURN_CHAR_TO_FACE_COORD hChar objX objY objZ
ENDWHILE
IF LOCATE_CHAR_ANY_MEANS_3D hChar objX objY objZ 2.0 2.0 1.0 FALSE
TASK_PLAY_ANIM hChar BOM_Plant BOMBER 4.0 FALSE FALSE FALSE FALSE -1
ENDIF
WAIT 5000
REMOVE_ANIMATION BOMBER
RETURN
GetObject:
IF DOES_CHAR_EXIST hChar
IF NOT IS_CHAR_SCRIPT_CONTROLLED hChar
AND NOT IS_CHAR_IN_ANY_CAR hChar
GET_PED_POINTER hChar pChar
READ_STRUCT_OFFSET pChar 0x59C 4 i //pPedstats
READ_MEMORY i 4 FALSE i
IF i = 26
OR i = 27
// any better way? tried with tasks
IF NOT IS_CHAR_PLAYING_ANIM hChar "sprint_panic"
AND NOT IS_CHAR_PLAYING_ANIM hChar "woman_runpanic"
READ_STRUCT_OFFSET pChar 0x764 4 i //m_nLastWeaponDamage (need more)
IF NOT i > 0
GET_CHAR_COORDINATES hChar charX charY charZ
IF GET_RANDOM_OBJECT_IN_SPHERE_NO_SAVE_RECURSIVE charX charY charZ 6.0 FALSE hObj
IF DOES_OBJECT_HAVE_THIS_MODEL hObj 1265 //blackbag2
RETURN_TRUE
RETURN
ENDIF
WHILE GET_RANDOM_OBJECT_IN_SPHERE_NO_SAVE_RECURSIVE charX charY charZ 6.0 TRUE hObj
IF DOES_OBJECT_HAVE_THIS_MODEL hObj 1265 //blackbag2
RETURN_TRUE
RETURN
ENDIF
ENDWHILE
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
RETURN_FALSE
RETURN
}
SCRIPT_END
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.