CLEO Help [CLEO HELP] Set Speed constantly cleo crash on startup.

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,734
Solutions
2
Reaction score
117
Ok seen as the cleo requests section was closed i decided that i should try and make my own request myself and of course i failed the script to me looks fine because i don't see why it would not work because im not good at scripting with sampfuncs using cmds etc but cmds are awesome.

Basically the aim was to be able to set your speed constantly so when you hold 2 your speed goes to 70 but stays at that speed to set the speed it was gonna be /.speed [ ENTER SPEED HERE] and when you press 2 it sets your speed to the speed you selected. Instead when i start up SAMP gta crashes "gta sa has stopped responding"

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

//-------------MAIN---------------
0000: NOP 
chatmsg "To set speed use /.speed" 12566463 
0B34: samp register_client_command ".speed" to_label @Noname_51 

:Noname_51
wait 0 
   SAMP.IsCommandTyped(1@)
chatmsg "Speed set to %d" 12566463 1@ 
goto @Noname_97 
SAMP.CmdRet

:Noname_97
wait 0 
if 
   Actor.Driving($PLAYER_ACTOR)
jf @Noname_97 
0@ = Actor.CurrentCar($PLAYER_ACTOR)
if 
key_down 50 
jf @Noname_97 
Car.SetSpeedInstantly(0@, 1@)
goto @Noname_97
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
First, you call a samp function before samp has entirely load and set up.
That's why we use
Code:
repeat
 wait 100
until 0AFA:  is_samp_available

Second, command thread should only be called when typing the command, so you need to add a loop or something to keep the script from reaching the command thread.

Code:
while true
    wait 0
    if and
        key_down 50
        Actor.Driving($PLAYER_ACTOR)
    then
        0@ = Actor.CurrentCar($PLAYER_ACTOR)
        if 056E:   car 0@ defined
        then Car.SetSpeedInstantly(0@, 1@)
        end
    end
end

Last, our command thread.
Code:
:SetCarSpeed
0B35: 1@
0C1A: 1@ = atoi 1@
chatmsg "Speed set to %d" 12566463 1@
cmdret
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,734
Solutions
2
Reaction score
117
Ok seems to work now cmds working but i don't think car.setspeedinstantly is working when i press 2 the vehicle im in stops instantly.

Code:
//-------------MAIN---------------
0000: NOP 

:Noname_2
wait 100 
   SAMP.Available
jf @Noname_2 
chatmsg "To set speed use /.speed" 12566463 
0B34: samp register_client_command ".speed" to_label @Noname_64 

:Noname_64
   SAMP.IsCommandTyped($speed)
0C1A: $speed = atoi $speed 
chatmsg "Speed set to %d" 12566463 $speed 
SAMP.CmdRet

:Noname_107
wait 0 
if and
key_down 50 
   Actor.Driving($PLAYER_ACTOR)
jf @Noname_163 
0@ = Actor.CurrentCar($PLAYER_ACTOR)
if 
056E:   car 0@ defined 
jf @Noname_163 
Car.SetSpeedInstantly(0@, $speed)

:Noname_163
goto @Noname_107
 
Status
Not open for further replies.
Top