Last active
January 5, 2024 17:56
-
-
Save JuniorDjjr/1b35ffd9411edaf5d97185cabe6f4efb 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
// 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 | |
LVAR_INT iChance iChanceLight iCurrentWeatherID iUpcomingWeatherID iDay iLastDay iMonth iLastMonth iLightRainTimeLimit i j | |
LVAR_FLOAT fLightRainIntensity fCurRain | |
GET_PLAYER_CHAR 0 (scplayer) | |
GET_CURRENT_DATE (iLastDay iLastMonth) | |
IF READ_INT_FROM_INI_FILE "CLEO/Rain Chance.ini" "Settings" "PercentChanceHeavy" (iChance) | |
ELSE | |
iChance = 20 | |
ENDIF | |
IF READ_INT_FROM_INI_FILE "CLEO/Rain Chance.ini" "Settings" "PercentChanceLight" (iChanceLight) | |
ELSE | |
iChanceLight = 20 | |
ENDIF | |
IF READ_FLOAT_FROM_INI_FILE "CLEO/Rain Chance.ini" "Settings" "LightRainIntensity" (fLightRainIntensity) | |
ELSE | |
fLightRainIntensity = 0.3 | |
ENDIF | |
WHILE TRUE | |
WAIT 0 | |
READ_MEMORY 0xC81318 2 FALSE (i) //forced weather | |
IF i = 65535 | |
GET_CURRENT_DATE (iDay iMonth) | |
IF iDay > iLastDay | |
OR iMonth > iLastMonth | |
IF CLEO_CALL Randomize 0 (iChanceLight) | |
GENERATE_RANDOM_INT_IN_RANGE 1 19 (iLightRainTimeLimit) | |
WHILE TRUE | |
WAIT 0 | |
GET_TIME_OF_DAY i j | |
IF i >= iLightRainTimeLimit | |
BREAK | |
ENDIF | |
ENDWHILE | |
READ_MEMORY 0xC81318 2 FALSE (i) //forced weather | |
IF NOT i = 65535 | |
CONTINUE | |
ENDIF | |
READ_MEMORY 0xC81320 2 FALSE (iCurrentWeatherID) | |
IF iCurrentWeatherID = 0 | |
OR iCurrentWeatherID = 2 | |
OR iCurrentWeatherID = 6 | |
OR iCurrentWeatherID = 11 | |
OR iCurrentWeatherID = 13 | |
OR iCurrentWeatherID >= 17 | |
//PRINT_FORMATTED_NOW "NO RUN BECAUSE DESERTT %d" 3000 iCurrentWeatherID | |
GOTO NotValidForLight | |
ELSE | |
READ_MEMORY 0xC81324 4 FALSE (fCurRain) //rain | |
IF fCurRain > 0.0 | |
GOTO NotValidForLight | |
ENDIF | |
fCurRain = 0.0 | |
timera = 0 | |
GET_TIME_OF_DAY i j | |
i += 2 | |
j = i + 11 | |
IF j > 23 | |
j = 23 | |
ENDIF | |
IF i > 22 | |
i = 22 | |
ENDIF | |
GENERATE_RANDOM_INT_IN_RANGE i j (iLightRainTimeLimit) | |
WHILE TRUE | |
WAIT 0 | |
IF fCurRain < fLightRainIntensity | |
fCurRain +=@ 0.005 | |
ENDIF | |
WRITE_MEMORY 0xC81324 4 fCurRain FALSE //rain | |
GET_TIME_OF_DAY i j | |
IF i > iLightRainTimeLimit | |
BREAK | |
ENDIF | |
READ_MEMORY 0xC81318 2 FALSE (i) //forced weather | |
IF NOT i = 65535 | |
fCurRain = 0.0 | |
BREAK | |
ENDIF | |
ENDWHILE | |
WHILE fCurRain > 0.0 | |
WAIT 0 | |
fCurRain -=@ 0.005 | |
WRITE_MEMORY 0xC81324 4 fCurRain FALSE //rain | |
ENDWHILE | |
fCurRain = 0.0 | |
WRITE_MEMORY 0xC81324 4 fCurRain FALSE //rain | |
ENDIF | |
ELSE | |
NotValidForLight: | |
IF CLEO_CALL Randomize 0 (iChance) | |
READ_MEMORY 0xC81320 2 FALSE (iCurrentWeatherID) | |
IF iCurrentWeatherID < 17 //desert | |
IF iCurrentWeatherID >= 0 | |
AND iCurrentWeatherID <= 4 | |
iUpcomingWeatherID = 4 | |
ELSE | |
IF iCurrentWeatherID >= 5 | |
AND iCurrentWeatherID <= 9 | |
IF CLEO_CALL Randomize 0 (50) | |
iUpcomingWeatherID = 7 | |
ELSE | |
iUpcomingWeatherID = 8 | |
ENDIF | |
ELSE | |
IF iCurrentWeatherID >= 13 | |
AND iCurrentWeatherID <= 16 | |
IF CLEO_CALL Randomize 0 (50) | |
iUpcomingWeatherID = 15 | |
ELSE | |
iUpcomingWeatherID = 16 | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDIF | |
WRITE_MEMORY 0xC8131C 2 iUpcomingWeatherID FALSE | |
ENDIF | |
ENDIF | |
ENDIF | |
iLastDay = iDay | |
iLastMonth = iMonth | |
ENDIF | |
ENDIF | |
ENDWHILE | |
} | |
SCRIPT_END | |
{ | |
LVAR_INT iPercent // In | |
LVAR_INT iEnd iRandom | |
Randomize: | |
GENERATE_RANDOM_INT_IN_RANGE 1 101 (iRandom) | |
IS_THING_GREATER_OR_EQUAL_TO_THING iPercent iRandom | |
CLEO_RETURN 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment