Last active
January 5, 2024 17:55
-
-
Save JuniorDjjr/5b5f3ac3a144e0bc6955cb1df929816d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// You need: https://forum.mixmods.com.br/f16-utilidades/t179-gta3script-while-true-return_true-e-return_false | |
SCRIPT_START | |
{ | |
LVAR_INT scplayer iCmd1 iCmd2 | |
LVAR_INT pOpenDistanceSmall pOpenDistanceBig pCloseDistanceSmall pCloseDistanceBig | |
LVAR_FLOAT fOpenDistanceSmall fOpenDistanceBig fCloseDistanceSmall fCloseDistanceBig | |
GET_PLAYER_CHAR 0 scplayer | |
WAIT 600 | |
GOSUB Patch | |
IF READ_INT_FROM_INI_FILE "CLEO/Press To Open Garage.ini" "Settings" "CMD1" (iCmd1) | |
AND iCmd1 > 0 | |
IF READ_INT_FROM_INI_FILE "CLEO/Press To Open Garage.ini" "Settings" "CMD2" (iCmd2) | |
ELSE | |
iCmd2 = -1 | |
ENDIF | |
ELSE | |
PRINT_STRING_NOW "~r~Fail to read 'Press To Open Garage.ini'" 1000 | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
WHILE TRUE | |
WAIT 0 | |
IF GOSUB IsPressingCMD | |
LOAD_ALL_MODELS_NOW // FIX ME: Do it only if player is near a garage | |
fOpenDistanceSmall = 100.0 | |
fOpenDistanceBig = 200.0 | |
fCloseDistanceSmall = 0.0 | |
fCloseDistanceBig = 0.0 | |
WHILE GOSUB IsPressingCMD | |
WAIT 0 | |
ENDWHILE | |
ELSE | |
fOpenDistanceSmall = 0.0 | |
fOpenDistanceBig = 0.0 | |
fCloseDistanceSmall = 500.0 | |
fCloseDistanceBig = 500.0 | |
ENDIF | |
ENDWHILE | |
IsPressingCMD: | |
IF iCmd1 <= 19 | |
IF NOT IS_BUTTON_PRESSED PAD1 iCmd1 | |
RETURN_FALSE | |
RETURN | |
ENDIF | |
ELSE | |
IF NOT IS_KEY_PRESSED iCmd1 | |
RETURN_FALSE | |
RETURN | |
ENDIF | |
ENDIF | |
IF iCmd2 > -1 | |
IF iCmd2 <= 19 | |
IF NOT IS_BUTTON_PRESSED PAD1 iCmd2 | |
RETURN_FALSE | |
RETURN | |
ENDIF | |
ELSE | |
IF NOT IS_KEY_PRESSED iCmd2 | |
RETURN_FALSE | |
RETURN | |
ENDIF | |
ENDIF | |
ENDIF | |
RETURN_TRUE | |
RETURN | |
Patch: | |
// Open | |
GET_VAR_POINTER fOpenDistanceSmall (pOpenDistanceSmall) | |
WRITE_MEMORY 0x44BEAC 4 pOpenDistanceSmall TRUE //12.5 | |
GET_VAR_POINTER fOpenDistanceBig (pOpenDistanceBig) | |
WRITE_MEMORY 0x44BEB9 4 pOpenDistanceBig TRUE //100.0 | |
// Close | |
GET_VAR_POINTER fCloseDistanceSmall (pCloseDistanceSmall) | |
WRITE_MEMORY 0x44BD3A 4 pCloseDistanceSmall TRUE //16.0 | |
GET_VAR_POINTER fCloseDistanceBig (pCloseDistanceBig) | |
WRITE_MEMORY 0x44BD29 4 pCloseDistanceBig TRUE //225.0 | |
RETURN | |
} | |
SCRIPT_END | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment