Last active
January 5, 2024 17:21
-
-
Save JuniorDjjr/9f6c0d79f165cb7f4c431af0dd906a58 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/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus | |
*/ | |
SCRIPT_START | |
{ | |
LVAR_INT scplayer i j hWheel hBase hHorses[16] hChar lListChars lListObjs hSong hSong2 | |
LVAR_FLOAT f fAngle fAngleProgress fAngleCarStep z | |
CONST_FLOAT WHEEL_DRAW_DISTANCE 320.0 | |
CONST_INT ID_BASE 19826 | |
CONST_INT ID_BODY 19825 | |
CONST_INT ID_HORSE1 19809 | |
CONST_INT TOTAL_CARS 16 | |
CONST_FLOAT TOTAL_CARS_FLOAT 16.0 | |
CONST_FLOAT TOTAL_CARS_FLOAT_HALF 8.0 | |
CONST_FLOAT POINT_X 353.90039 | |
CONST_FLOAT POINT_Y -2030.35522 | |
CONST_FLOAT POINT_Z 13.14550 | |
CONST_FLOAT WHEEL_X 353.90039 | |
CONST_FLOAT WHEEL_Y -2030.35522 | |
CONST_FLOAT WHEEL_Z 8.62730 | |
CONST_FLOAT WHEEL_X_BASE 353.90039 | |
CONST_FLOAT WHEEL_Y_BASE -2030.35522 | |
CONST_FLOAT WHEEL_Z_BASE 13.14550 | |
WAIT 3000 | |
GET_PLAYER_CHAR 0 scplayer | |
CREATE_LIST DATATYPE_INT lListChars | |
CREATE_LIST DATATYPE_INT lListObjs | |
WHILE TRUE | |
WAIT 0 | |
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES POINT_X POINT_Y POINT_Z WHEEL_DRAW_DISTANCE | |
GOSUB CreateObjects | |
IF LOAD_3D_AUDIO_STREAM "CLEO\Carousel\rct2-merry-go-round-the-blond-sailor.mp3" (hSong) | |
LOAD_3D_AUDIO_STREAM "CLEO\Carousel\rct2-merry-go-round-the-blond-sailor.mp3" (hSong2) // to amplify | |
SET_PLAY_3D_AUDIO_STREAM_AT_OBJECT hSong hBase | |
SET_PLAY_3D_AUDIO_STREAM_AT_OBJECT hSong2 hBase | |
GET_AUDIO_SFX_VOLUME f | |
SET_AUDIO_STREAM_VOLUME hSong f | |
SET_AUDIO_STREAM_VOLUME hSong2 f | |
SET_AUDIO_STREAM_LOOPED hSong TRUE | |
SET_AUDIO_STREAM_LOOPED hSong2 TRUE | |
SET_AUDIO_STREAM_STATE hSong 1 | |
SET_AUDIO_STREAM_STATE hSong2 1 | |
ELSE | |
//PRINT_FORMATTED_NOW "cant find song" 1000 | |
hSong = -1 | |
ENDIF | |
WHILE LOCATE_CAMERA_DISTANCE_TO_COORDINATES WHEEL_X WHEEL_Y WHEEL_Z WHEEL_DRAW_DISTANCE | |
WAIT 0 | |
fAngleProgress +=@ 0.3 | |
WHILE fAngleProgress > 36000.0 // the algorithm bugs if we use 0-360, but it's safer to reset if the value is too high (after too much spins) | |
fAngleProgress -= 36000.0 | |
ENDWHILE | |
GOSUB UpdateRotation | |
IF NOT hSong = -1 | |
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES WHEEL_X WHEEL_Y WHEEL_Z 200.0 | |
GET_AUDIO_SFX_VOLUME f | |
DRAW_LIGHT_WITH_RANGE WHEEL_X WHEEL_Y WHEEL_Z 255 200 100 10.0 | |
ELSE | |
f = 0.0 | |
ENDIF | |
SET_AUDIO_STREAM_VOLUME hSong f | |
SET_AUDIO_STREAM_VOLUME hSong2 f | |
ENDIF | |
ENDWHILE | |
GOSUB DeleteObjects | |
IF NOT hSong = -1 | |
REMOVE_AUDIO_STREAM hSong | |
ENDIF | |
ENDIF | |
ENDWHILE | |
CreateObjects: | |
REQUEST_ANIMATION ON_LOOKERS | |
WHILE NOT HAS_ANIMATION_LOADED ON_LOOKERS | |
WAIT 0 | |
ENDWHILE | |
REPEAT TOTAL_CARS i | |
j = ID_HORSE1 | |
j += i | |
CREATE_OBJECT_NO_SAVE j WHEEL_X WHEEL_Y WHEEL_Z FALSE FALSE (hHorses[i]) | |
ENDREPEAT | |
CREATE_OBJECT_NO_SAVE ID_BASE WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE FALSE FALSE (hBase) | |
SET_OBJECT_ROTATION hBase 0.0 0.0 90.0 | |
CREATE_OBJECT_NO_SAVE ID_BODY WHEEL_X WHEEL_Y WHEEL_Z FALSE FALSE (hWheel) | |
SET_OBJECT_ROTATION hWheel 0.0 0.0 90.0 | |
CREATE_RANDOM_CHAR WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE (hChar) | |
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN hChar 0 1 1 | |
CREATE_OBJECT_NO_SAVE 1238 WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE FALSE FALSE (j) | |
SET_OBJECT_VISIBLE j OFF | |
ATTACH_OBJECT_TO_OBJECT j hHorses[0] -3.824 1.798 -0.204 0.0 0.0 150.0 | |
ATTACH_CHAR_TO_OBJECT hChar j 0.0 0.0 0.0 FACING_FORWARD 0.0 WEAPONTYPE_UNARMED | |
IF GOSUB UseAltAnim | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar wave_loop ON_LOOKERS 4.0 1 0 0 1 -1 | |
ELSE | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar Jetpack_Idle PED 4.0 1 0 0 1 -1 | |
ENDIF | |
LIST_ADD lListChars hChar | |
LIST_ADD lListObjs j | |
CREATE_RANDOM_CHAR WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE (hChar) | |
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN hChar 0 1 1 | |
CREATE_OBJECT_NO_SAVE 1238 WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE FALSE FALSE (j) | |
SET_OBJECT_VISIBLE j OFF | |
ATTACH_OBJECT_TO_OBJECT j hHorses[15] 1.393 2.681 -0.204 0.0 0.0 64.0 | |
ATTACH_CHAR_TO_OBJECT hChar j 0.0 0.0 0.0 FACING_FORWARD 0.0 WEAPONTYPE_UNARMED | |
IF GOSUB UseAltAnim | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar wave_loop ON_LOOKERS 4.0 1 0 0 1 -1 | |
ELSE | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar Jetpack_Idle PED 4.0 1 0 0 1 -1 | |
ENDIF | |
LIST_ADD lListChars hChar | |
LIST_ADD lListObjs j | |
CREATE_RANDOM_CHAR WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE (hChar) | |
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN hChar 0 1 1 | |
CREATE_OBJECT_NO_SAVE 1238 WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE FALSE FALSE (j) | |
SET_OBJECT_VISIBLE j OFF | |
ATTACH_OBJECT_TO_OBJECT j hHorses[12] 4.024 1.406 -0.204 0.0 0.0 21.0 | |
ATTACH_CHAR_TO_OBJECT hChar j 0.0 0.0 0.0 FACING_FORWARD 0.0 WEAPONTYPE_UNARMED | |
IF GOSUB UseAltAnim | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar wave_loop ON_LOOKERS 4.0 1 0 0 1 -1 | |
ELSE | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar Jetpack_Idle PED 4.0 1 0 0 1 -1 | |
ENDIF | |
LIST_ADD lListChars hChar | |
LIST_ADD lListObjs j | |
CREATE_RANDOM_CHAR WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE (hChar) | |
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN hChar 0 1 1 | |
CREATE_OBJECT_NO_SAVE 1238 WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE FALSE FALSE (j) | |
SET_OBJECT_VISIBLE j OFF | |
ATTACH_OBJECT_TO_OBJECT j hHorses[9] 0.94 -2.868 -0.204 0.0 0.0 -67.5 | |
ATTACH_CHAR_TO_OBJECT hChar j 0.0 0.0 0.0 FACING_FORWARD 0.0 WEAPONTYPE_UNARMED | |
IF GOSUB UseAltAnim | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar wave_loop ON_LOOKERS 4.0 1 0 0 1 -1 | |
ELSE | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar Jetpack_Idle PED 4.0 1 0 0 1 -1 | |
ENDIF | |
LIST_ADD lListChars hChar | |
LIST_ADD lListObjs j | |
CREATE_RANDOM_CHAR WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE (hChar) | |
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN hChar 0 1 1 | |
CREATE_OBJECT_NO_SAVE 1238 WHEEL_X_BASE WHEEL_Y_BASE WHEEL_Z_BASE FALSE FALSE (j) | |
SET_OBJECT_VISIBLE j OFF | |
ATTACH_OBJECT_TO_OBJECT j hHorses[8] 1.384 -3.982 -0.204 0.0 0.0 -67.5 | |
ATTACH_CHAR_TO_OBJECT hChar j 0.0 0.0 0.0 FACING_FORWARD 0.0 WEAPONTYPE_UNARMED | |
IF GOSUB UseAltAnim | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar wave_loop ON_LOOKERS 4.0 1 0 0 1 -1 | |
ELSE | |
TASK_PLAY_ANIM_NON_INTERRUPTABLE hChar Jetpack_Idle PED 4.0 1 0 0 1 -1 | |
ENDIF | |
LIST_ADD lListChars hChar | |
LIST_ADD lListObjs j | |
// set start 0.0 as start point | |
fAngleProgress = 0.0 | |
GOSUB UpdateRotation | |
RETURN | |
UseAltAnim: | |
GET_CHAR_STAT_ID hChar (i) | |
IF i = PEDSTAT_BEACH_GIRL | |
OR i = PEDSTAT_COWARD | |
IF NOT IS_CHAR_MALE hChar | |
RETURN_TRUE | |
RETURN | |
ENDIF | |
ENDIF | |
RETURN_FALSE | |
RETURN | |
DeleteObjects: | |
timera = 0 | |
GET_LIST_SIZE lListChars (i) | |
WHILE timera < i | |
GET_LIST_VALUE_BY_INDEX lListChars timera (hChar) | |
GET_LIST_VALUE_BY_INDEX lListObjs timera (j) | |
DELETE_CHAR hChar | |
DELETE_OBJECT j | |
timera += 1 | |
ENDWHILE | |
RESET_LIST lListChars | |
RESET_LIST lListObjs | |
DELETE_OBJECT hBase | |
DELETE_OBJECT hWheel | |
REPEAT TOTAL_CARS i | |
DELETE_OBJECT hHorses[i] | |
ENDREPEAT | |
RETURN | |
UpdateRotation: | |
fAngleCarStep = fAngleProgress / TOTAL_CARS_FLOAT_HALF | |
REPEAT TOTAL_CARS i | |
f =# i | |
f *= 0.5 | |
f *= fAngleCarStep | |
f += fAngleProgress | |
/*IF i = 2 | |
PRINT_FORMATTED_NOW "final %f step %f" 1000 f fAngleCarStep | |
ENDIF*/ | |
fAngle = f * TOTAL_CARS_FLOAT_HALF | |
z = WHEEL_Z + 0.2 | |
SIN fAngle (f) | |
IF IS_LOCAL_VAR_BIT_SET_CONST i 0 | |
f *= -1.0 | |
ENDIF | |
f *= 0.2 | |
z += f | |
SET_OBJECT_COORDINATES hHorses[i] WHEEL_X WHEEL_Y z | |
SET_OBJECT_ROTATION hHorses[i] 0.0 0.0 fAngleProgress | |
ENDREPEAT | |
SET_OBJECT_ROTATION hWheel 0.0 0.0 fAngleProgress | |
SET_OBJECT_ROTATION hBase 0.0 0.0 fAngleProgress | |
RETURN | |
} | |
SCRIPT_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment