CLEO Help Cleo Warner

CLEO related
Status
Not open for further replies.

KennyDixon

Member
Joined
Jan 1, 2016
Messages
8
Reaction score
0
I've been trying to create a script which would make GTA continuously beep if the vehicle's engine is turned off, but unfortunately the crash occurs when i try to turn it on. Where's the problem?

Code:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
03A4: name_thread "Warner" 

:Warner_22
0001: wait 0 ms 
00D6: if and
0AB0:   key_pressed 88
0AB0:   key_pressed 67 
004D: jump_if_false @Warner_22 
0001: wait 1000 ms
018C: play_sound 1058 at 0.0 0.0 0.0 
0002: jump @Warner_77 

:Warner_77
0001: wait 0 ms
00D6: if or
8AB0:   not key_pressed 88 
8AB0:   not key_pressed 67 
004D: jump_if_false @Warner_450
00D6: if
0ABE:   is_car_engine_on 1@
004D: jump_if_false @Warner_77
0002: jump @Warner_144 

:Warner_144
0001: wait 0 ms
018C: play_sound 1147 at 0.0 0.0 0.0 
0001: wait 200 ms                                                
0002: jump @Warner_77


:Warner_450
0001: wait 1000 ms 
018C: play_sound 1057 at 0.0 0.0 0.0 
0002: jump @Warner_22
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
0ABE:  is_car_engine_on 1@

1@ is not a handle to a car, is an empty var.

use

03C0: 1@ = actor $PLAYER_ACTOR car
if 056E:  car 1@ defined
then
    ...
end
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
If the player is on foot 1@ will be a null pointer, if then you use "0ABE:  is_car_engine_on 1@" you'll crash, so the correct order is get car, check if car exist, check engine status.
 
Status
Not open for further replies.
Top