Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// by Junior_Djjr - MixMods.com.br
// You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus
SCRIPT_START
{
LVAR_INT scplayer i j hChar[4] iCharCp[4] iCharPlayerLapCompleted iPlayerCp lfCpsX lfCpsY lfCpsZ lBlips iTotalCps
LVAR_FLOAT x y z iCharSpeed[4]
WAIT 500
GET_PLAYER_CHAR 0 (scplayer)
//SET_CHAR_COORDINATES scplayer -657.1205 -1900.2402 6.2
ADD_TEXT_LABEL OKIPLUP "OK I PULL UP"
ADD_TEXT_LABEL OKIPLU1 "~1~"
ADD_TEXT_LABEL OKIPLUG "GO!"
WHILE TRUE
WAIT 0
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES -657.2944 -1898.4609 6.2561 50.0
AND NOT IS_ON_MISSION
IF LOCATE_STOPPED_CHAR_ON_FOOT_3D scplayer -657.2944 -1898.4609 6.2561 1.5 1.5 3.0 TRUE
SET_PLAYER_CONTROL 0 OFF
SET_EVERYONE_IGNORE_PLAYER 0 TRUE
DO_FADE 500 FADE_OUT
WAIT 500
LOAD_SPECIAL_CHARACTER 5 capybar
LOAD_ALL_MODELS_NOW
SET_PLAYER_MODEL 0 SPECIAL05
BUILD_PLAYER_MODEL 0
GOSUB CreateCheckpointsList
SET_CHAR_COORDINATES scplayer -671.0 -1891.6 5.8
SET_CHAR_HEADING scplayer 170.0
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN scplayer TRUE TRUE FALSE
RESTORE_CAMERA_JUMPCUT
CREATE_CHAR PEDTYPE_MISSION1 SPECIAL05 -673.0 -1891.6 5.8 (hChar[0])
CLEO_CALL SetupChar 0 (hChar[0] 170.0)
CREATE_CHAR PEDTYPE_MISSION1 SPECIAL05 -675.0 -1891.6 5.8 (hChar[1])
CLEO_CALL SetupChar 0 (hChar[1] 170.0)
CREATE_CHAR PEDTYPE_MISSION1 SPECIAL05 -669.0 -1891.6 5.8 (hChar[2])
CLEO_CALL SetupChar 0 (hChar[2] 170.0)
CREATE_CHAR PEDTYPE_MISSION1 SPECIAL05 -667.0 -1891.6 5.8 (hChar[3])
CLEO_CALL SetupChar 0 (hChar[3] 170.0)
DO_FADE 500 FADE_IN
WAIT 1000
PRINT_WITH_NUMBER_BIG OKIPLU1 3 1100 4
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_RACE_321
WAIT 1000
PRINT_WITH_NUMBER_BIG OKIPLU1 2 1100 4
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_RACE_321
WAIT 1000
PRINT_WITH_NUMBER_BIG OKIPLU1 1 1100 4
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_RACE_321
WAIT 1000
PRINT_BIG OKIPLUG 800 4
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_RACE_GO
GOSUB Start
WHILE TRUE
WAIT 0
IF GOSUB UpdateCharsCp
BREAK
ENDIF
IF IS_CHAR_DEAD scplayer
OR NOT IS_PLAYER_PLAYING 0
OR NOT LOCATE_CAMERA_DISTANCE_TO_COORDINATES -657.2944 -1898.4609 6.2561 600.0
BREAK
ENDIF
ENDWHILE
CLEAR_CHAR_TASKS_IMMEDIATELY scplayer
GOSUB RemoveBlips
GOSUB RemoveChars
DELETE_LIST lfCpsX
DELETE_LIST lfCpsY
DELETE_LIST lfCpsZ
UNLOAD_SPECIAL_CHARACTER 5
SET_PLAYER_MODEL 0 0
BUILD_PLAYER_MODEL 0
ENDIF
ENDIF
ENDWHILE
Start:
i = 0
WHILE i < 4
iCharCp[i] = 1
GET_LIST_VALUE_BY_INDEX lfCpsX iCharCp[i] (x)
GET_LIST_VALUE_BY_INDEX lfCpsY iCharCp[i] (y)
GET_LIST_VALUE_BY_INDEX lfCpsZ iCharCp[i] (z)
TASK_GO_STRAIGHT_TO_COORD hChar[i] x y z 7 0x7FFFFFFF
GENERATE_RANDOM_FLOAT_IN_RANGE 1.25 1.3 (iCharSpeed[i])
++i
ENDWHILE
iPlayerCp = 1
GOSUB UpdateBlips
SET_PLAYER_CONTROL 0 ON
SET_EVERYONE_IGNORE_PLAYER 0 FALSE
RETURN
Completed:
IF NOT IS_LOCAL_VAR_BIT_SET_CONST iCharPlayerLapCompleted 5 //not someone already finished
PRINT_BIG OKIPLUP 5000 1 //"Mission Passed!"
ADD_SCORE 0 420
PLAY_MISSION_PASSED_TUNE 1
ELSE
PRINT_BIG M_FAIL 5000 1
ENDIF
WAIT 6000
RETURN
RemoveBlips:
i = 0
WHILE i < iTotalCps
GET_LIST_VALUE_BY_INDEX lBlips i (j)
REMOVE_BLIP j
++i
ENDWHILE
DELETE_LIST lBlips
RETURN
RemoveChars:
i = 0
WHILE i < 4
DELETE_CHAR hChar[i]
++i
ENDWHILE
RETURN
UpdateCharsCp:
i = 0
WHILE i < 4
GET_LIST_VALUE_BY_INDEX lfCpsX iCharCp[i] (x)
GET_LIST_VALUE_BY_INDEX lfCpsY iCharCp[i] (y)
GET_LIST_VALUE_BY_INDEX lfCpsZ iCharCp[i] (z)
IF LOCATE_CHAR_ANY_MEANS_3D hChar[i] x y z 3.0 3.0 5.0 FALSE
IF iCharCp[i] = 0
IF IS_LOCAL_VAR_BIT_SET_LVAR iCharPlayerLapCompleted i
// I'm lazy to code a race position system
SET_LOCAL_VAR_BIT_CONST iCharPlayerLapCompleted 5 //someone already finished
CLEAR_CHAR_TASKS hChar[i]
++i
CONTINUE
ENDIF
SET_LOCAL_VAR_BIT_LVAR iCharPlayerLapCompleted i
ENDIF
iCharCp[i] += 1
IF iCharCp[i] >= iTotalCps
iCharCp[i] = 0
ENDIF
GET_LIST_VALUE_BY_INDEX lfCpsX iCharCp[i] (x)
GET_LIST_VALUE_BY_INDEX lfCpsY iCharCp[i] (y)
GET_LIST_VALUE_BY_INDEX lfCpsZ iCharCp[i] (z)
IF NOT IS_CHAR_DEAD hChar[i]
TASK_GO_STRAIGHT_TO_COORD hChar[i] x y z 7 0x7FFFFFFF
ENDIF
IF IS_LOCAL_VAR_BIT_SET_LVAR iCharPlayerLapCompleted i
GENERATE_RANDOM_FLOAT_IN_RANGE 1.0 1.1 (iCharSpeed[i])
ELSE
GENERATE_RANDOM_FLOAT_IN_RANGE 1.13 1.2 (iCharSpeed[i])
ENDIF
ENDIF
IF IS_CHAR_PLAYING_ANIM hChar[i] sprint_panic
SET_CHAR_ANIM_SPEED hChar[i] sprint_panic iCharSpeed[i]
ENDIF
IF IS_CHAR_PLAYING_ANIM hChar[i] run_civi
SET_CHAR_ANIM_SPEED hChar[i] run_civi iCharSpeed[i]
ENDIF
IF IS_CHAR_PLAYING_ANIM hChar[i] WALK_civi
SET_CHAR_ANIM_SPEED hChar[i] WALK_civi iCharSpeed[i]
ENDIF
++i
ENDWHILE
GET_LIST_VALUE_BY_INDEX lfCpsX iPlayerCp (x)
GET_LIST_VALUE_BY_INDEX lfCpsY iPlayerCp (y)
GET_LIST_VALUE_BY_INDEX lfCpsZ iPlayerCp (z)
IF LOCATE_CHAR_ANY_MEANS_3D scplayer x y z 4.0 4.0 5.0 TRUE
IF iPlayerCp = 0
IF IS_LOCAL_VAR_BIT_SET_CONST iCharPlayerLapCompleted 4
GOSUB Completed
RETURN_TRUE
RETURN
ENDIF
SET_LOCAL_VAR_BIT_CONST iCharPlayerLapCompleted 4
ENDIF
iPlayerCp += 1
REPORT_MISSION_AUDIO_EVENT_AT_POSITION 0.0 0.0 0.0 SOUND_RACE_321
IF iPlayerCp >= iTotalCps
iPlayerCp = 0
ENDIF
GOSUB UpdateBlips
ENDIF
RETURN_FALSE
RETURN
UpdateBlips:
i = 0
WHILE i < iTotalCps
GET_LIST_VALUE_BY_INDEX lBlips i (j)
IF i = iPlayerCp
IF i = 0
AND IS_LOCAL_VAR_BIT_SET_CONST iCharPlayerLapCompleted 4
CHANGE_BLIP_COLOUR j 6
ELSE
CHANGE_BLIP_COLOUR j 4
ENDIF
ELSE
CHANGE_BLIP_COLOUR j 3
ENDIF
LIST_ADD lBlips j
++i
ENDWHILE
RETURN
CreateCheckpointsList:
CREATE_LIST DATATYPE_FLOAT lfCpsX
CREATE_LIST DATATYPE_FLOAT lfCpsY
CREATE_LIST DATATYPE_FLOAT lfCpsZ
CREATE_LIST DATATYPE_INT lBlips
LIST_ADD lfCpsX -671.0
LIST_ADD lfCpsY -1891.6
LIST_ADD lfCpsZ 5.8
LIST_ADD lfCpsX -677.0718
LIST_ADD lfCpsY -1958.3157
LIST_ADD lfCpsZ 19.0304
LIST_ADD lfCpsX -690.0659
LIST_ADD lfCpsY -2093.0671
LIST_ADD lfCpsZ 25.2009
LIST_ADD lfCpsX -724.4761
LIST_ADD lfCpsY -2123.0596
LIST_ADD lfCpsZ 25.8884
LIST_ADD lfCpsX -759.5526
LIST_ADD lfCpsY -2121.6538
LIST_ADD lfCpsZ 24.981
LIST_ADD lfCpsX -795.2103
LIST_ADD lfCpsY -2084.1523
LIST_ADD lfCpsZ 24.7052
LIST_ADD lfCpsX -848.9034
LIST_ADD lfCpsY -1987.1935
LIST_ADD lfCpsZ 18.0675
LIST_ADD lfCpsX -798.2243
LIST_ADD lfCpsY -1893.9641
LIST_ADD lfCpsZ 10.2468
LIST_ADD lfCpsX -718.207
LIST_ADD lfCpsY -1859.9667
LIST_ADD lfCpsZ 12.8023
LIST_ADD lfCpsX -687.4713
LIST_ADD lfCpsY -1862.6713
LIST_ADD lfCpsZ 13.4713
GET_LIST_SIZE lfCpsX iTotalCps
i = 0
WHILE i < iTotalCps
GET_LIST_VALUE_BY_INDEX lfCpsX i (x)
GET_LIST_VALUE_BY_INDEX lfCpsY i (y)
GET_LIST_VALUE_BY_INDEX lfCpsZ i (z)
ADD_BLIP_FOR_COORD x y z j
LIST_ADD lBlips j
++i
ENDWHILE
iCharPlayerLapCompleted = 0
RETURN
}
SCRIPT_END
{
LVAR_INT hChar //In
LVAR_FLOAT fHeading //In
SetupChar:
SET_CHAR_HEADING hChar fHeading
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN hChar TRUE TRUE FALSE
CLEO_RETURN 0 ()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment