GET_PLAYER_CHAR scplayer scplayer
LVAR_INT scplayer health car
You tried to store the player handle to a var that wasn't declared yet (scripts are read from top to bottom), and you didn't use the command properly .
The right way:
Código: Selecionar tudo
LVAR_INT var
GET_PLAYER_CHAR 0 (var)
Using the code above, you get the player1 handle (which is 0) and then you store it to a previously declared var.
The indentation is all wrong. (actually, you didn't use indentation at all)
WAIT 0
IF IS_CHAR_SITTING_IN_ANY_CAR scplayer
GET_CAR_CHAR_IS_USING scplayer car
IF NOT IS_CAR_DEAD car
AND NOT IS_CAR_UPSIDEDOWN car
AND NOT IS_CAR_ON_FIRE car
GOTO_IF_FALSE main
GET_CAR_HEALTH car health
IF
health <= 560
PRINT_STRING_NOW "Radiator ~r~Damaged~r" 1000
ELSE
IF health <= 400
PRINT_STRING_NOW "Enigne Damaged" 2000
ELSE
IF health <= 330
PRINT_STRING_NOW "Engine ~r~Dead~r~" 3000
SET_CAR_ENGINE_BROKEN car TRUE
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Indentantion may not seem so important on tiny codes like that one, but seriously, look at this:
Look at the second code. Did you manage to distinguish where each IF is open/closed? I bet you didn't. A code with no indentation is awful and confusing. Not only for those who read your codes, but also for you. If you don't use indentation, you'll easily get lost on your own codes when you make more complex scripts.
Read the tutorials. If you really want to learn CLEO (or any programming language), get in your room, lock up the door, stay away from any social network, don't even think on listening to music, and get ready to spend hours, days, months studying .