Skip to content

Instantly share code, notes, and snippets.

@JuniorDjjr
Created March 10, 2019 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save JuniorDjjr/5f6345fbf2d2b45a90c1d9918fa0b917 to your computer and use it in GitHub Desktop.
Save JuniorDjjr/5f6345fbf2d2b45a90c1d9918fa0b917 to your computer and use it in GitHub Desktop.
// by Junior_Djjr - MixMods.com.br
// You need: https://forum.mixmods.com.br/f16-utilidades/t179-gta3script-while-true-return_true-e-return_false
SCRIPT_START
{
LVAR_INT scplayer hVeh pVeh p_bVehicleCreatedBy i pTrailer
LVAR_INT iKey1 iKey2
CONST_INT M_bVehicleCreatedBy 0x4A4
CONST_INT M_pTrailer 0x4C8
CONST_INT RANDOM_VEHICLE 1
CONST_INT MISSION_VEHICLE 2
CONST_INT PARKED_VEHICLE 3
CONST_INT PERMANENT_VEHICLE 4
/////////////////////////////////////////////
GET_PLAYER_CHAR 0 scplayer
IF NOT READ_INT_FROM_INI_FILE "cleo/Never Despawn.ini" "Command" "Key1" (iKey1)
iKey1 = 46
ENDIF
IF NOT READ_INT_FROM_INI_FILE "cleo/Never Despawn.ini" "Command" "Key2" (iKey2)
iKey2 = 82
ENDIF
/////////////////////////////////////////////
WHILE TRUE
WAIT 0
IF IS_CHAR_SITTING_IN_ANY_CAR scplayer
IF IS_KEY_PRESSED iKey1
AND IS_KEY_PRESSED iKey2
STORE_CAR_CHAR_IS_IN_NO_SAVE scplayer hVeh
GET_VEHICLE_POINTER hVeh (pVeh)
p_bVehicleCreatedBy = pVeh + M_bVehicleCreatedBy
READ_MEMORY p_bVehicleCreatedBy 1 FALSE (i)
IF NOT i = MISSION_VEHICLE
i = MISSION_VEHICLE
PRINT_STRING_NOW "~s~Never Despawn: ~g~ON" 1000
ELSE
i = RANDOM_VEHICLE
PRINT_STRING_NOW "~s~Never Despawn: ~r~OFF" 1000
ENDIF
WRITE_MEMORY p_bVehicleCreatedBy 1 (i) FALSE
pTrailer = pVeh + M_pTrailer
READ_MEMORY pTrailer 4 FALSE (pTrailer)
IF pTrailer > 0
CLEO_CALL ApplyTrailersRecursive 0 (pTrailer i)()
ENDIF
ENDIF
WHILE IS_KEY_PRESSED iKey1
AND IS_KEY_PRESSED iKey2
WAIT 0
ENDWHILE
ENDIF
ENDWHILE
}
SCRIPT_END
/////////////////////////////////////////////
{
LVAR_INT pTrailer iCreatedBy // In
LVAR_INT i
ApplyTrailersRecursive:
i = pTrailer + M_bVehicleCreatedBy
WRITE_MEMORY i 2 (iCreatedBy) FALSE
i = pTrailer + M_pTrailer
READ_MEMORY i 4 FALSE (pTrailer)
IF pTrailer > 0
CLEO_CALL ApplyTrailersRecursive 0 (pTrailer iCreatedBy)()
ENDIF
CLEO_RETURN 0 ()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment