Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SCRIPT_START
{
LVAR_INT scplayer bUsingCompressor hCompressorObject iLanguage iKey bInfos iModel
LVAR_FLOAT x y z x2 y2 z2
CONST_INT LANG_PT 1
CONST_INT LANG_EN 2
GET_PLAYER_CHAR 0 scplayer
IF READ_INT_FROM_INI_FILE "cleo\compressor.ini" "Settings" "lang" iLanguage
AND READ_INT_FROM_INI_FILE "cleo\compressor.ini" "Settings" "key" iKey
AND READ_INT_FROM_INI_FILE "cleo\compressor.ini" "Settings" "infos" bInfos
AND READ_INT_FROM_INI_FILE "cleo\compressor.ini" "Settings" "model" iModel
ELSE
PRINT_STRING_NOW "~r~Mod Compressor: Fail to load compressor.ini" 7000
TERMINATE_THIS_CUSTOM_SCRIPT
ENDIF
IF NOT IS_MODEL_AVAILABLE iModel
PRINT_FORMATTED_NOW "~r~Mod Compressor: Model ID %i isn't installed -~n~Modelo de ID %i nao esta instalado." 10000 iModel iModel
TERMINATE_THIS_CUSTOM_SCRIPT
ENDIF
GOTO var_types_jump
CREATE_OBJECT 0 0.0 0.0 0.0 hCompressorObject
var_types_jump:
main_loop:
WAIT 0
IF NOT IS_CHAR_SITTING_IN_ANY_CAR scplayer
IF IS_CURRENT_CHAR_WEAPON scplayer WEAPONTYPE_SPRAYCAN
WHILE IS_CURRENT_CHAR_WEAPON scplayer WEAPONTYPE_SPRAYCAN
AND NOT IS_CHAR_SITTING_IN_ANY_CAR scplayer
WAIT 0
GOSUB CheckObjectValid
IF bUsingCompressor = TRUE
SET_PLAYER_FIRE_BUTTON 0 ON
ELSE
SET_PLAYER_FIRE_BUTTON 0 OFF
ENDIF
IF IS_KEY_PRESSED iKey
GOSUB UpdateObject
ENDIF
IF DOES_OBJECT_EXIST hCompressorObject
IF NOT LOCATE_CHAR_ANY_MEANS_OBJECT_3D scplayer hCompressorObject 20.0 20.0 20.0 FALSE
SET_PLAYER_FIRE_BUTTON 0 ON
GOSUB DeleteObject
GOTO main_loop
ENDIF
ENDIF
ENDWHILE
GOSUB DeleteObject
SET_PLAYER_FIRE_BUTTON 0 ON
ENDIF
ENDIF
GOTO main_loop
UpdateObject:
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer (-0.5 -1.7 -0.8) (x y z)
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer (0.5 -2.0 -0.5) (x2 y2 z2)
IF IS_AREA_OCCUPIED x2 y2 z2 x y z FALSE TRUE FALSE FALSE FALSE
IF bInfos = ON
IF iLanguage = LANG_PT
PRINT_STRING "~r~Nao ha como colocar o compressor ai, esta muito proximo de um veiculo." 500
ELSE
PRINT_STRING "~r~There is no way to put the compressor there, is very close to a vehicle." 500
ENDIF
ENDIF
ELSE
GOSUB DeleteObject
GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS scplayer (0.0 -1.0 -1.0) (x y z)
CREATE_OBJECT iModel (x y z) hCompressorObject
ENDIF
RETURN
CheckObjectValid:
IF DOES_OBJECT_EXIST hCompressorObject
IF LOCATE_CHAR_ANY_MEANS_OBJECT_3D scplayer hCompressorObject 3.5 3.5 3.5 FALSE
bUsingCompressor = TRUE
RETURN
ELSE
IF IS_BUTTON_PRESSED PAD1 CIRCLE
IF bInfos = ON
IF iLanguage = LANG_PT
PRINT_STRING "~r~Voce esta muito longe do compressor." 200
ELSE
PRINT_STRING "~r~You're too far from compressor." 200
ENDIF
ENDIF
ENDIF
ENDIF
ELSE
IF IS_BUTTON_PRESSED PAD1 CIRCLE
IF bInfos = ON
IF iLanguage = LANG_PT
PRINT_STRING "~r~Voce precisa de um compressor." 200
ELSE
PRINT_STRING "~r~You need a compressor." 200
ENDIF
ENDIF
ENDIF
ENDIF
bUsingCompressor = FALSE
RETURN
DeleteObject:
IF DOES_OBJECT_EXIST hCompressorObject
DELETE_OBJECT hCompressorObject
ENDIF
RETURN
}
SCRIPT_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.