Skip to content

Instantly share code, notes, and snippets.

@JuniorDjjr
Last active January 5, 2024 17:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JuniorDjjr/38ba16704a2de63fd7ea31711d6e9e0f to your computer and use it in GitHub Desktop.
Save JuniorDjjr/38ba16704a2de63fd7ea31711d6e9e0f to your computer and use it in GitHub Desktop.
// by Junior_Djjr - MixMods.com.br
//you need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleo
SCRIPT_START
{
LVAR_INT scplayer pBuffer pKeyBuffer i j lDateIcons iIcon hCleoBlip px py bDebugForceEnexAccess bIsDateIcon pRespawnCoords bDebugShowEnexName bDelayForJizzy
LVAR_TEXT_LABEL tSectionName
LVAR_FLOAT x y
WAIT 0
WAIT 0
WAIT 20
LOAD_TEXTURE_DICTIONARY MRDICNS
LOAD_SPRITE 1 radar_dateNude
LOAD_SPRITE 2 radar_donuts
LOAD_SPRITE 3 radar_store
LOAD_SPRITE 4 radar_train
LOAD_SPRITE 5 radar_intrack
LOAD_SPRITE 6 radar_casino
GET_LABEL_POINTER Buffer (pBuffer)
GET_LABEL_POINTER KeyBuffer (pKeyBuffer)
GET_VAR_POINTER x (px)
GET_VAR_POINTER y (py)
CREATE_LIST DATATYPE_INT lDateIcons
READ_INT_FROM_INI_FILE "CLEO\More Radar Icons.ini" "Settings" "DebugForceEnexAccess" (bDebugForceEnexAccess)
READ_INT_FROM_INI_FILE "CLEO\More Radar Icons.ini" "Settings" "DebugShowEnexName" (bDebugShowEnexName)
bIsDateIcon = FALSE
tSectionName = Store
GET_TEXTURE_FROM_SPRITE 3 (iIcon)
GOSUB ReadIniSection
tSectionName = Casino
GET_TEXTURE_FROM_SPRITE 6 (iIcon)
GOSUB ReadIniSection
tSectionName = InTrack
GET_TEXTURE_FROM_SPRITE 5 (iIcon)
GOSUB ReadIniSection
tSectionName = AmmuNat
iIcon = 6
GOSUB ReadIniSection
tSectionName = SexShop
GET_TEXTURE_FROM_SPRITE 1 (iIcon) //same as strip, placeholder
GOSUB ReadIniSection
tSectionName = Donuts
GET_TEXTURE_FROM_SPRITE 2 (iIcon)
GOSUB ReadIniSection
tSectionName = Barber
iIcon = 7
GOSUB ReadIniSection
tSectionName = Pizza
iIcon = 29
GOSUB ReadIniSection
tSectionName = Airport
iIcon = 5
GOSUB ReadIniSection
tSectionName = Ship
iIcon = 9
GOSUB ReadIniSection
tSectionName = Fire
iIcon = 20
GOSUB ReadIniSection
tSectionName = Race
iIcon = 33
GOSUB ReadIniSection
tSectionName = Gym
iIcon = 54
GOSUB ReadIniSection
tSectionName = Train
GET_TEXTURE_FROM_SPRITE 4 (iIcon)
GOSUB ReadIniSection
tSectionName = Car
iIcon = 55
GOSUB ReadIniSection
tSectionName = Police
iIcon = 30
GOSUB ReadIniSection
tSectionName = Hosp
iIcon = 22
GOSUB ReadIniSection
GOSUB CreateDateIcons
WAIT 0
tSectionName = Strip
GET_TEXTURE_FROM_SPRITE 1 (iIcon)
bDelayForJizzy = TRUE
GOSUB ReadIniSection
// -- Main loop
WHILE TRUE
IF bDebugShowEnexName = TRUE
WAIT 0
GET_PLAYER_CHAR 0 scplayer
GET_PED_POINTER scplayer i
READ_STRUCT_OFFSET i 0x78C 4 (i)
IF i > 0x0
DRAW_STRING $i DRAW_EVENT_AFTER_HUD 150.0 300.0 0.5 1.0 TRUE FONT_MENU
ENDIF
ELSE
WAIT 2345
ENDIF
GET_SCRIPT_STRUCT_NAMED GFDATE i
IF NOT i = 0
GOSUB ClearDateIcons
WAIT 500
WHILE TRUE
WAIT 0
CLEO_CALL ReadGlobalVar 0 (390)(i)
IF NOT IS_LOCAL_VAR_BIT_SET_CONST i 1
BREAK
ENDIF
ENDWHILE
GOSUB CreateDateIcons
WAIT 500
ENDIF
ENDWHILE
// -- end of Main loop
ClearDateIcons:
GET_LIST_SIZE lDateIcons (j)
i = 0
WHILE i < j
GET_LIST_VALUE_BY_INDEX lDateIcons i (hCleoBlip)
REMOVE_CLEO_BLIP hCleoBlip
++i
ENDWHILE
RESET_LIST lDateIcons
RETURN
CreateDateIcons:
bIsDateIcon = TRUE
tSectionName = Club
iIcon = 48
GOSUB ReadIniSection
tSectionName = Bar
iIcon = 49
GOSUB ReadIniSection
LIST_ADD lDateIcons hCleoBlip
tSectionName = Rest
iIcon = 50
GOSUB ReadIniSection
LIST_ADD lDateIcons hCleoBlip
tSectionName = Dinner
iIcon = 17
GOSUB ReadIniSection
LIST_ADD lDateIcons hCleoBlip
bIsDateIcon = FALSE
RETURN
ReadIniSection:
IF READ_INT_FROM_INI_FILE "CLEO\More Radar Icons.ini" $tSectionName "Enabled" (j)
AND j = TRUE
// Read enex names
i = 1
WHILE TRUE
STRING_FORMAT pKeyBuffer "EnexName%i" i
IF READ_STRING_FROM_INI_FILE "CLEO\More Radar Icons.ini" $tSectionName $pKeyBuffer (pBuffer)
//PRINT_FORMATTED_NOW "%s - %s" 200 $tSectionName $pBuffer
//WAIT 200
// because EHI delays it a lot to add it
IF bDelayForJizzy = TRUE
IF IS_STRING_EQUAL $pBuffer "PDOMES2" 8 FALSE ""
WAIT 8100
ENDIF
ENDIF
//pFindEnexName bOnlyExterior iIcon bDebugForceEnexAccess bIsDateIcon lDateIcons
CLEO_CALL CreateCleoBlipInEnexName 0 ($pBuffer 1 iIcon bDebugForceEnexAccess bIsDateIcon lDateIcons)()
ELSE
BREAK
ENDIF
++i
ENDWHILE
// Read coords
i = 1
WHILE TRUE
STRING_FORMAT pKeyBuffer "Coord%i" i
IF READ_STRING_FROM_INI_FILE "CLEO\More Radar Icons.ini" $tSectionName $pKeyBuffer (pBuffer)
//sscanf because SCAN_STRING doesn't work on current gta3script version
CALL_FUNCTION_RETURN 0x8220AD 4 4 (py px, "%f%f" pBuffer)(j)
IF j = 2
//PRINT_FORMATTED_NOW "%s - %s" 200 $tSectionName $pBuffer
//WAIT 200
ADD_CLEO_BLIP iIcon x y TRUE 255 255 255 255 (hCleoBlip)
IF bIsDateIcon = TRUE
LIST_ADD lDateIcons hCleoBlip
ENDIF
ENDIF
ELSE
BREAK
ENDIF
++i
ENDWHILE
IF READ_INT_FROM_INI_FILE "CLEO\More Radar Icons.ini" $tSectionName "UseRespawn" (j)
AND j = TRUE
IF iIcon = 22 //hosp
READ_MEMORY 0xA4326C 4 TRUE (j)
ELSE
IF iIcon = 30 //police
READ_MEMORY 0xA43268 4 TRUE (j)
ENDIF
ENDIF
IF j > 0
j *= 12 // size of vector3
// limit adjuster adaptation
IF iIcon = 22 //hosp
READ_MEMORY 0x5D379A 4 TRUE (pRespawnCoords)
ELSE
IF iIcon = 30 //police
READ_MEMORY 0x5D37F9 4 TRUE (pRespawnCoords)
ENDIF
ENDIF
i = 0
WHILE i < j
READ_STRUCT_OFFSET pRespawnCoords i 4 (x)
i += 4
READ_STRUCT_OFFSET pRespawnCoords i 4 (y)
//i += 4
//READ_STRUCT_OFFSET pRespawnCoords i 4 (z)
//i += 4
i += 8
ADD_CLEO_BLIP iIcon x y TRUE 255 255 255 255 (hCleoBlip)
IF bIsDateIcon = TRUE
LIST_ADD lDateIcons hCleoBlip
ENDIF
ENDWHILE
ENDIF
ENDIF
ENDIF
bDelayForJizzy = FALSE
RETURN
}
SCRIPT_END
{
LVAR_INT pFindEnexName bOnlyExterior iIcon bDebugForceEnexAccess bIsDateIcon lDateIcons //In
LVAR_INT i offset pEnex iAreaCode pEnexPool pEnexArray iEnexCount hCleoBlip iFlags iStringLen
LVAR_FLOAT x y f
CreateCleoBlipInEnexName:
READ_MEMORY 0x96A7D8 4 FALSE (pEnexPool)
READ_STRUCT_OFFSET pEnexPool 0x0 4 (pEnexArray)
READ_STRUCT_OFFSET pEnexPool 0x8 4 (iEnexCount)
//PRINT_FORMATTED_NOW "%x %d" 1 pEnexArray iEnexCount
i = 0
WHILE i < iEnexCount
offset = i * 0x3C //size of
pEnex = pEnexArray + offset
//GET_TEXT_LABEL_STRING $pEnex (pBuffer)
READ_STRUCT_OFFSET pEnex 0x32 1 (iAreaCode)
IF iAreaCode = 0
OR bOnlyExterior = FALSE
READ_STRUCT_OFFSET pEnex 0x30 2 (iFlags)
IF bDebugForceEnexAccess = TRUE
SET_LOCAL_VAR_BIT_CONST iFlags 14
WRITE_STRUCT_OFFSET pEnex 0x30 2 iFlags
ENDIF
IF IS_LOCAL_VAR_BIT_SET_CONST iFlags 14
GET_STRING_LENGTH $pEnex (iStringLen)
IF iStringLen > 0
IF IS_STRING_EQUAL $pFindEnexName $pEnex 8 FALSE "" // name is +0x0
READ_STRUCT_OFFSET pEnex 0x8 4 (x)
READ_STRUCT_OFFSET pEnex 0xC 4 (y)
// exception: jizzy club duplication
GET_DISTANCE_BETWEEN_COORDS_2D x y -2661.603271 1424.836304 (f)
IF f > 10.0
//READ_STRUCT_OFFSET pEnex 0x18 4 (z)
ADD_CLEO_BLIP iIcon x y TRUE 255 255 255 255 (hCleoBlip)
IF bIsDateIcon = TRUE
LIST_ADD lDateIcons hCleoBlip
ENDIF
//PRINT_FORMATTED_NOW "found enexname '%s' coord %.2f %.2f" 2000 $pFindEnexName x y
//WAIT 2000
ENDIF
//SET_CHAR_COORDINATES scplayer x y z
//FREEZE_CHAR_POSITION scplayer ON
/*WHILE TRUE
WAIT 0
IF iInterior = 0
PRINT_FORMATTED_NOW "%d %s = %s - %.2f %.2f %.2f" 100 i p pBuffer x y z
ELSE
PRINT_FORMATTED_NOW "~r~%d %s = %s - %.2f %.2f %.2f" 100 i p pBuffer x y z
ENDIF
IF IS_KEY_JUST_PRESSED 107
offset += 0x3C //size of
++i
BREAK
ENDIF
IF IS_KEY_JUST_PRESSED 109
offset -= 0x3C //size of
--i
BREAK
ENDIF
ENDWHILE*/
ENDIF
ENDIF
ENDIF
ENDIF
++i
ENDWHILE
CLEO_RETURN 0 ()
}
{
LVAR_INT var //In
LVAR_INT value scriptSpace finalOffset
ReadGlobalVar:
READ_MEMORY 0x00468D5E 4 1 (scriptSpace)
finalOffset = var * 4
finalOffset += scriptSpace
READ_MEMORY finalOffset 4 FALSE (value)
CLEO_RETURN 0 (value)
}
KeyBuffer:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //16
ENDDUMP
Buffer:
DUMP
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //128
ENDDUMP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment