Last active
January 5, 2024 17:23
-
-
Save JuniorDjjr/b4fb03f09189a5e49e66f58852c12944 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 | |
// for Buy Property Mod (optional) | |
// You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus | |
SCRIPT_START | |
{ | |
LVAR_INT iState // External script will start this and set the first var to state. | |
LVAR_INT scplayer iPlayerId iHour bLodLighting hGenerator bLaddersModInstalled i lLaddersList pLadder | |
LVAR_FLOAT x y z f fProgress | |
CONST_INT STATE_NOT_STARTED_BY_EXTERNAL 0 // remembering, the default value for vars is always 0 | |
CONST_INT STATE_JUST_BOUGHT 1 | |
CONST_INT STATE_ALREADY_BOUGHT 2 | |
CONST_INT LADDER_PARAM_BOTTOM_X 0 | |
CONST_INT LADDER_PARAM_BOTTOM_Y 1 | |
CONST_INT LADDER_PARAM_BOTTOM_Z 2 | |
CONST_INT LADDER_PARAM_BOTTOM_MARGIN 3 | |
CONST_INT LADDER_PARAM_TOP_X 4 | |
CONST_INT LADDER_PARAM_TOP_Y 5 | |
CONST_INT LADDER_PARAM_TOP_Z 6 | |
CONST_INT LADDER_PARAM_TOP_MARGIN 7 | |
CONST_INT LADDER_PARAM_ANGLE 8 | |
CONST_INT LADDER_PARAM_MOVE_SPEED 9 | |
CONST_INT LADDER_PARAM_TOTAL 10 | |
// This will terminate this script if was not started from external. | |
// This occurs if you try to install it on modloader or CLEO root folder. | |
IF iState = STATE_NOT_STARTED_BY_EXTERNAL | |
// In this case, I want to make the person be able to install this script also without Buy Property Mod, in this case, jump the bought condition if installed this script on cleo folder | |
iState = STATE_ALREADY_BOUGHT | |
//TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
// Note: you can't use SAVE_THIS_CUSTOM_SCRIPT in this case, but if you really need it, make this script do something for other scripts that uses. | |
// Do stuff if just bought (create car generators, radar icons, enable interiors etc... Maybe some additional message) | |
// Called just 1 time. | |
IF iState = STATE_JUST_BOUGHT | |
ENDIF | |
// Do stuff for already bought properties. | |
// This is called every time the game starts with the property purchased. ALSO just after you bought it. | |
IF iState = STATE_ALREADY_BOUGHT | |
CREATE_CAR_GENERATOR -1347.7808 -2375.2952 34.0 270.0 QUAD 51 27 TRUE 0 0 0 2000 (hGenerator) | |
SWITCH_CAR_GENERATOR hGenerator 101 // make it spawns forever | |
SET_CAR_GENERATOR_NO_SAVE hGenerator | |
// for Ladders Mod | |
// example: https://gist.github.com/JuniorDjjr/357f671af3cb6e27fcf39e996e447494 | |
GET_SCRIPT_STRUCT_NAMED LADDERS (i) | |
IF NOT i = 0 | |
GET_SCRIPT_VAR i 0 (lLaddersList) | |
IF NOT lLaddersList = 0 | |
bLaddersModInstalled = TRUE | |
GET_LABEL_POINTER Ladder1 (pLadder) | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_BOTTOM_X -1357.1019 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_BOTTOM_Y -2377.5803 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_BOTTOM_Z 33.9159 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_BOTTOM_MARGIN 0.82 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_TOP_X -1357.8684 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_TOP_Y -2377.5586 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_TOP_Z 43.1777 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_TOP_MARGIN 2.2 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_ANGLE 90.0 | |
WRITE_STRUCT_PARAM pLadder LADDER_PARAM_MOVE_SPEED 0.522 | |
LIST_ADD lLaddersList pLadder | |
ENDIF | |
ENDIF | |
WHILE TRUE | |
WAIT 0 | |
IF LOCATE_CAMERA_DISTANCE_TO_COORDINATES -1357.2391 -2377.5474 33.9134 50.0 | |
GOSUB Init | |
WHILE LOCATE_CAMERA_DISTANCE_TO_COORDINATES -1357.2391 -2377.5474 33.9134 55.0 | |
WAIT 0 | |
IF bLaddersModInstalled = FALSE | |
iPlayerId = 0 | |
GOSUB ProcessPlayer | |
IF IS_2PLAYER_GAME_GOING_ON | |
iPlayerId = 1 | |
GOSUB ProcessPlayer | |
ENDIF | |
ENDIF | |
GOSUB ProcessLights | |
ENDWHILE | |
ENDIF | |
ENDWHILE | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ProcessLights: | |
GET_CURRENT_HOUR (iHour) | |
GET_ACTIVE_CAMERA_COORDINATES (x y z) | |
IF z > 40.0 | |
bLodLighting = FALSE | |
ELSE | |
bLodLighting = TRUE | |
ENDIF | |
IF y > -2377.2971 | |
CLEO_CALL ProcessThisLight 0 (-1356.723389, -2376.651855, 47.027981 fProgress bLodLighting)() | |
ENDIF | |
CLEO_CALL ProcessThisLight 0 (-1368.877686, -2393.937988, 47.504097 fProgress bLodLighting)() | |
IF iHour >= 20 | |
OR iHour <= 5 | |
CLEO_CALL ProcessThisLight 0 (-1359.047852, -2372.566650, 47.592751 fProgress bLodLighting)() | |
CLEO_CALL ProcessThisLight 0 (-1362.786133, -2374.640381, 42.833961 fProgress bLodLighting)() | |
CLEO_CALL ProcessThisLight 0 (-1366.317261, -2357.295410, 43.761662 fProgress bLodLighting)() | |
ENDIF | |
fProgress +=@ 0.1 | |
IF fProgress > 100000.0 // to avoid issues after some hours playing at same location | |
fProgress = -100000.0 | |
ENDIF | |
RETURN | |
ProcessPlayer: | |
GET_PLAYER_CHAR iPlayerId (scplayer) | |
IF NOT IS_CHAR_IN_ANY_CAR scplayer | |
AND NOT IS_CHAR_DEAD scplayer | |
GET_CHAR_COORDINATES scplayer x y z | |
IF z > 41.0 | |
IF LOCATE_STOPPED_CHAR_ON_FOOT_3D scplayer -1358.6278 -2377.5557 43.0 1.0 1.0 2.0 TRUE | |
GOSUB FadeOutLadder | |
SET_CHAR_COORDINATES scplayer -1355.671 -2377.6028 33.5 | |
SET_CHAR_HEADING scplayer 270.0 | |
GOSUB FadeInLadder | |
ENDIF | |
ELSE | |
IF LOCATE_STOPPED_CHAR_ON_FOOT_3D scplayer -1357.2391 -2377.5474 33.5 1.4 1.4 2.0 TRUE | |
GOSUB FadeOutLadder | |
SET_CHAR_COORDINATES scplayer -1359.0605 -2376.0 43.0 | |
SET_CHAR_HEADING scplayer 0.0 | |
GOSUB FadeInLadder | |
ENDIF | |
ENDIF | |
ENDIF | |
RETURN | |
FadeOutLadder: | |
IF NOT IS_2PLAYER_GAME_GOING_ON // don't fade it if 2 players | |
SET_PLAYER_CONTROL_PAD_MOVEMENT iPlayerId OFF | |
DO_FADE 500 FADE_OUT | |
WAIT 550 // this will turn off the lights, but you can't see it | |
ENDIF | |
RETURN | |
FadeInLadder: | |
IF NOT IS_2PLAYER_GAME_GOING_ON // don't fade it if 2 players | |
DO_FADE 1000 FADE_IN | |
RESTORE_CAMERA_JUMPCUT | |
FIX_CHAR_GROUND_BRIGHTNESS_AND_FADE_IN scplayer TRUE TRUE FALSE | |
SET_PLAYER_CONTROL_PAD_MOVEMENT iPlayerId ON | |
ENDIF | |
RETURN | |
Init: | |
fProgress = -100000.0 | |
// trying to stop corona from being hide near camera (I can't yet) | |
/*MAKE_NOP 0x6FB1F2 2 | |
MAKE_NOP 0x6FB1FD 2 | |
MAKE_NOP 0x6FB214 2 | |
MAKE_NOP 0x70D728 6 | |
MAKE_NOP 0x70D742 6 | |
WRITE_MEMORY 0x6FB1F1 1 0 TRUE*/ | |
RETURN | |
} | |
SCRIPT_END | |
{ | |
LVAR_FLOAT x y z fProgress //In | |
LVAR_INT bLodLighting //In | |
LVAR_FLOAT fRadius f | |
LVAR_INT i j iUniqueId pX | |
ProcessThisLight: | |
f = fProgress + x | |
PERLIN_NOISE f (fRadius) | |
fRadius *= 0.04 | |
fRadius += 0.25 | |
//DRAW_CORONA x y z fRadius CORONATYPE_SHINYSTAR FLARETYPE_NONE 255 100 0 | |
// call corona register manually for better options | |
GET_VAR_POINTER x (pX) | |
iUniqueId -= 100000 | |
i =# x | |
iUniqueId += i | |
i =# y | |
iUniqueId += i | |
i =# z | |
iUniqueId += i | |
iUniqueId += 42069 | |
CALL_FUNCTION 0x6FC580 21 21 (0 0 100.0 0 0.0 0 0.0 0 0 0 0 0 40.0 fRadius pX 255 0 100 255 0 iUniqueId) | |
//void __cdecl CCoronas::RegisterCorona | |
//(int uniqueID, #39 *entity, unsigned __int8 r, unsigned __int8 g, unsigned __int8 b, unsigned __int8 alpha, CVector *pos, float radius, | |
//float farClip, int type, char flareType, bool enableReflection, bool checkObstacles, int ?notUsed, float angle, bool longDistance, float nearClip, | |
//bool fadeState, float fadeSpeed, bool onlyFromBelow, bool reflectionDelay) | |
fRadius /= 2.0 | |
//DRAW_CORONA x y z fRadius CORONATYPE_SHINYSTAR FLARETYPE_NONE 255 230 200 | |
iUniqueId += 100 | |
CALL_FUNCTION 0x6FC580 21 21 (0 0 100.0 0 0.0 0 0.0 0 0 0 0 0 40.0 fRadius pX 255 200 220 255 0 iUniqueId) | |
IF bLodLighting = FALSE | |
f = fRadius * 1000.0 | |
i =# f | |
f = fRadius * 400.0 | |
j =# f | |
//PRINT_FORMATTED_NOW "%f" 1000 f | |
CLAMP_INT i 1 255 (i) | |
CLAMP_INT j 1 255 (j) | |
DRAW_LIGHT_WITH_RANGE x y z i j 0 10.0 | |
i /= 4 | |
j /= 4 | |
DRAW_SHADOW 3 x y z 0.0 1.0 100 i j 0 | |
ENDIF | |
CLEO_RETURN 0 () | |
} | |
Ladder1: | |
DUMP | |
00 00 00 00 //LADDER_PARAM_BOTTOM_X | |
00 00 00 00 //LADDER_PARAM_BOTTOM_Y | |
00 00 00 00 //LADDER_PARAM_BOTTOM_Z | |
00 00 00 00 //LADDER_PARAM_BOTTOM_MARGIN | |
00 00 00 00 //LADDER_PARAM_TOP_X | |
00 00 00 00 //LADDER_PARAM_TOP_Y | |
00 00 00 00 //LADDER_PARAM_TOP_Z | |
00 00 00 00 //LADDER_PARAM_TOP_MARGIN | |
00 00 00 00 //LADDER_PARAM_ANGLE | |
00 00 00 00 //LADDER_PARAM_MOVE_SPEED | |
FF FF FF FF //terminator | |
ENDDUMP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment