Last active
January 5, 2024 18:08
-
-
Save JuniorDjjr/2a19e92183d45fca8d9590a5e8b9892d 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 i j playerId mode ignoredLastFrame[2] noWantedLastFrame maxWantedBackup playerWithUniform[2] numPlayersUsing dontEnableFor2players maxWantedLevelBeforeEnterInterior iSaved iOnGarage scplayer p alwaysEnabled | |
LVAR_FLOAT x y z r ro | |
GET_PLAYER_CHAR 0 scplayer | |
iSaved = -1 | |
maxWantedBackup = 6 | |
SET_MAX_WANTED_LEVEL 6 | |
WAIT 500 | |
IF NOT READ_INT_FROM_INI_FILE "CLEO/Cop Outfit.ini" "Settings" "Mode" (mode) | |
OR mode < 1 | |
OR mode > 3 | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF READ_INT_FROM_INI_FILE "CLEO/Cop Outfit.ini" "Settings" "AlwaysEnabled" (alwaysEnabled) | |
ENDIF | |
SET_SCRIPT_EVENT_SAVE_CONFIRMATION ON OnSaveConfirmation iSaved | |
WHILE TRUE | |
WAIT 90 | |
IF alwaysEnabled = 0 | |
numPlayersUsing = 0 | |
dontEnableFor2players = FALSE | |
GET_CHAR_MODEL scplayer i | |
GET_MODEL_PED_TYPE i (j i) | |
IF IS_PLAYER_WEARING 0 17 POLICETR | |
OR i = PEDSTAT_COP | |
OR i = PEDSTAT_MEDIC | |
OR i = PEDSTAT_FIREMAN | |
playerWithUniform[0] = TRUE | |
numPlayersUsing++ | |
ENDIF | |
IF IS_2PLAYER_GAME_GOING_ON | |
GET_PLAYER_CHAR 1 i | |
GET_CHAR_MODEL i i | |
GET_MODEL_PED_TYPE i (j i) | |
IF IS_PLAYER_WEARING 1 17 POLICETR | |
OR i = PEDSTAT_COP | |
OR i = PEDSTAT_MEDIC | |
OR i = PEDSTAT_FIREMAN | |
playerWithUniform[1] = TRUE | |
numPlayersUsing++ | |
ELSE | |
dontEnableFor2players = TRUE | |
ENDIF | |
ENDIF | |
ELSE | |
IF IS_2PLAYER_GAME_GOING_ON | |
numPlayersUsing = 2 | |
dontEnableFor2players = TRUE | |
ELSE | |
numPlayersUsing = 1 | |
ENDIF | |
ENDIF | |
//numPlayersUsing = 1 | |
GET_CITY_PLAYER_IS_IN 0 (i) | |
IF NOT i = 0 | |
IF i = 1 | |
x = 1579.425 | |
y = -1636.463 | |
z = 14.5812 | |
r = 70.0 | |
ro = 75.0 | |
ELSE | |
IF i = 2 | |
x = -1624.771 | |
y = 679.6637 | |
z = 8.569 | |
r = 70.0 | |
ro = 75.0 | |
ELSE | |
IF i = 3 | |
x = 2284.592 | |
y = 2466.838 | |
z = 12.2306 | |
r = 100.0 | |
ro = 105.0 | |
ENDIF | |
ENDIF | |
ENDIF | |
IF LOCATE_CHAR_DISTANCE_TO_COORDINATES scplayer x y z r | |
IF iOnGarage = FALSE | |
AND numPlayersUsing > 0 | |
GET_SCRIPT_STRUCT_NAMED IMPND (j) | |
IF j > 0 | |
//WRITE_STRUCT_OFFSET j 0xCC 4 1000000 | |
READ_STRUCT_OFFSET j 16 4 (j) //base ip | |
READ_STRUCT_OFFSET j 21756 2 (i) | |
IF i = 0x0364 //spotted char opcode | |
i = j + 21756 | |
WRITE_MEMORY i 12 0 TRUE | |
//WRITE_STRUCT_OFFSET j 21756 12 0x00 | |
WRITE_STRUCT_OFFSET j 3625 4 0 | |
//PRINT_STRING_NOW "Patch" 2000 | |
iOnGarage = TRUE | |
//ELSE | |
//PRINT_STRING_NOW "Already Patch" 2000 | |
ENDIF | |
//ELSE | |
//PRINT_STRING_NOW "Cant Patch" 2000 | |
ENDIF | |
ENDIF | |
ENDIF | |
IF iOnGarage = TRUE | |
IF NOT LOCATE_CHAR_DISTANCE_TO_COORDINATES scplayer x y z ro | |
OR numPlayersUsing = 0 | |
GET_SCRIPT_STRUCT_NAMED IMPND (j) | |
IF j > 0 | |
READ_STRUCT_OFFSET j 16 4 (j) //base ip | |
i = j + 21756 | |
GET_LABEL_POINTER BackupGarageSpottedCharCommand (p) | |
COPY_MEMORY p i 12 | |
WRITE_STRUCT_OFFSET j 3625 4 5.0 | |
//PRINT_STRING_NOW "Unpatch" 2000 | |
iOnGarage = FALSE | |
//ELSE | |
//PRINT_STRING_NOW "Cant Unpatch" 2000 | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDIF | |
GET_AREA_VISIBLE i | |
IF NOT i = 0 | |
GET_MAX_WANTED_LEVEL maxWantedLevelBeforeEnterInterior | |
SET_MAX_WANTED_LEVEL maxWantedBackup | |
WHILE NOT i = 0 | |
WAIT 0 | |
IF iSaved >= 0 | |
iSaved = -1 | |
BREAK | |
ENDIF | |
GET_AREA_VISIBLE i | |
IF maxWantedLevelBeforeEnterInterior = 0 | |
ALTER_WANTED_LEVEL 0 0 | |
ENDIF | |
ENDWHILE | |
SET_MAX_WANTED_LEVEL maxWantedLevelBeforeEnterInterior | |
ENDIF | |
IF numPlayersUsing > 0 | |
IF mode < 3 | |
GOSUB ApplySCMfixes | |
ENDIF | |
IF mode > 1 | |
playerId = 0 | |
GOSUB ApplyIgnore | |
playerId = 1 | |
GOSUB ApplyIgnore | |
ENDIF | |
IF mode = 3 | |
IF dontEnableFor2players = FALSE | |
GET_MAX_WANTED_LEVEL (i) | |
IF noWantedLastFrame = FALSE | |
AND i > 0 | |
maxWantedBackup = i | |
noWantedLastFrame = TRUE | |
ENDIF | |
SET_MAX_WANTED_LEVEL 0 | |
ELSE | |
IF noWantedLastFrame = TRUE | |
SET_MAX_WANTED_LEVEL maxWantedBackup | |
noWantedLastFrame = FALSE | |
ENDIF | |
ENDIF | |
ENDIF | |
ELSE | |
IF mode = 3 | |
IF noWantedLastFrame = TRUE | |
SET_MAX_WANTED_LEVEL maxWantedBackup | |
noWantedLastFrame = FALSE | |
ENDIF | |
ENDIF | |
ENDIF | |
ENDWHILE | |
OnSaveConfirmation: | |
SET_MAX_WANTED_LEVEL maxWantedBackup | |
noWantedLastFrame = FALSE | |
RETURN_SCRIPT_EVENT | |
ApplySCMfixes: | |
GET_SCRIPT_STRUCT_NAMED INTMAN (i) | |
IF i > 0 | |
i += 0x14 //ip | |
READ_MEMORY i 4 FALSE (i) | |
i += 3010 | |
READ_MEMORY i 1 TRUE (j) | |
IF j = 0 | |
OR j = 2 | |
IF dontEnableFor2players = FALSE | |
WRITE_MEMORY i 1 (0) TRUE | |
ELSE | |
WRITE_MEMORY i 1 (2) TRUE | |
ENDIF | |
ENDIF | |
ENDIF | |
RETURN | |
ApplyIgnore: | |
IF playerWithUniform[playerId] = TRUE | |
SET_POLICE_IGNORE_PLAYER playerId (TRUE) | |
ignoredLastFrame[playerId] = TRUE | |
ELSE | |
IF ignoredLastFrame[playerId] = TRUE // Avoid disabling the ignore every time, for better compatibility | |
ignoredLastFrame[playerId] = FALSE | |
SET_POLICE_IGNORE_PLAYER playerId (FALSE) | |
ENDIF | |
ENDIF | |
RETURN | |
} | |
SCRIPT_END | |
BackupGarageSpottedCharCommand: | |
DUMP | |
64 03 07 50 A4 0C 00 08 00 02 0C 00 | |
//00 0C 02 00 08 00 0C A4 50 07 03 64 | |
ENDDUMP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment