Skip to content

Instantly share code, notes, and snippets.

@JuniorDjjr
Created May 18, 2020 01:23
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/b5794e04cc2e216eca192bf3e98bc7ea to your computer and use it in GitHub Desktop.
Save JuniorDjjr/b5794e04cc2e216eca192bf3e98bc7ea to your computer and use it in GitHub Desktop.
// by Junior_Djjr - MixMods.com.br. If you want to reuse it for another vehicle, keep credits.
// You need: https://forum.mixmods.com.br/f16-utilidades/t179-gta3script-while-true-return_true-e-return_false
SCRIPT_START
{
LVAR_INT scplayer hVeh playerId iModel
LVAR_FLOAT x y z targetX targetY targetZ
IF NOT READ_INT_FROM_INI_FILE "CLEO/Military Ferry (Junior_Djjr).ini" "Settings" "ModelId" (iModel)
iModel = 454
ENDIF
GET_PLAYER_CHAR 0 scplayer
WHILE TRUE
WAIT 0
playerId = 0
GOSUB Process
IF IS_2PLAYER_GAME_GOING_ON
playerId = 1
GOSUB Process
ENDIF
ENDWHILE
Process:
GET_PLAYER_CHAR playerId scplayer
IF IS_BUTTON_PRESSED playerId LEFTSHOULDER1
IF IS_CHAR_SITTING_IN_ANY_CAR scplayer
AND IS_PLAYER_PLAYING playerId
AND IS_PLAYER_CONTROL_ON playerId
STORE_CAR_CHAR_IS_IN_NO_SAVE scplayer hVeh
IF IS_CAR_DEAD hVeh
OR NOT IS_CAR_MODEL hVeh iModel
RETURN
ENDIF
// Limit time to shoot
IF playerId = 0
IF timera < 200
RETURN
ENDIF
ELSE
IF timerb < 200
RETURN
ENDIF
ENDIF
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS hVeh -0.95 -2.2 2.5 x y z
GET_OFFSET_FROM_CAR_IN_WORLD_COORDS hVeh 0.0 200.0 0.0 targetX targetY targetZ
FIRE_SINGLE_BULLET x y z targetX targetY targetZ 150
REPORT_MISSION_AUDIO_EVENT_AT_CAR hVeh 1157
ADD_BIG_GUN_FLASH x y z targetX targetY targetZ
// Reset shoot timer
IF playerId = 0
timera = 0
ELSE
timerb = 0
ENDIF
ENDIF
ENDIF
RETURN
}
SCRIPT_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment