Página 1 de 1

O script só é ativado se o jogador estiver dentro de algum veículo

Enviado: 26 Out 2018, 13:26
por MCHammer
Oi gente.

Estou editando um script .cs que achei na internet, que tem como sua função fazer com que as luzes pisquem em uma determinada função, porém ele tem alguns problemas, que são:

1° Se eu ativo fora de um carro, o jogo crasha;
2° Se eu ativo dentro do carro e saio, ele desativa, porém, mostra um warning (estou testando no SAMP).​​​​​​

Queria saber se alguém pode me ajudar a corrigir esses pequenos problemas, já que eu não tenho muito conhecimento em .cs.

Código: Selecionar tudo

{$CLEO .cs}

thread 'STROBOS'

:STROBOS
wait 0
    Player.Defined($PLAYER_CHAR)
jf @STROBOS
if or
    Actor.Driving($PLAYER_ACTOR)
    847A:   not actor $PLAYER_ACTOR driving_bike
    84A7:   not actor $PLAYER_ACTOR driving_boat
    84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle
    not Actor.DrivingVehicleType($PLAYER_ACTOR, #BMX)
jf @STROBOS
jump @STROBOS_ONLINE

:STROBOS_ONLINE
wait 0
0AB0:   key_pressed 123
jf @STROBOS_ONLINE
jump @STROBOS_STARTING

:STROBOS_STARTING
wait 0
0@ = Actor.CurrentCar($PLAYER_ACTOR)
0A97: 1@ = car 0@ struct
1@ += 1440
067F: set_car 0@ lights 2
wait 60
jump @STROBOS_FLASHING

:STROBOS_FLASHING
// Both Flashing
wait 120
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
wait 120
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 1
wait 120
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
wait 120
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 1
wait 120
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
wait 120
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 1
wait 120
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
if
0AB0:   key_pressed 123
jf @STROBOS_FLASHING
wait 60
jump @STROBOS_FINISHING

:STROBOS_FINISHING
wait 60
067F: set_car 0@ lights 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 3
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
wait 60
Car.RemoveReferences(0@)
jump @STROBOS

Re: O script só é ativado se o jogador estiver dentro de algum veículo  [RESOLVIDO]

Enviado: 26 Out 2018, 19:30
por HybridTheory
SpoilerAbrir

Código: Selecionar tudo

{$CLEO}
0000:

while true
    wait 0
    if and
    Actor.Driving($PLAYER_ACTOR)
    847A:   not actor $PLAYER_ACTOR driving_bike
    84A7:   not actor $PLAYER_ACTOR driving_boat
    84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle
    not Actor.DrivingVehicleType($PLAYER_ACTOR, #BMX)
    then
        if 0AB0:   key_pressed 123
        then
            0@ = Actor.CurrentCar($PLAYER_ACTOR)
            0A97: 1@ = car 0@ struct
            1@ += 1440
            067F: set_car 0@ lights 2 
            gosub @STROBOS_FLASHING
            while 0AB0:   key_pressed 123
                wait 0
            end  
        end
    end
end

:STROBOS_FLASHING
repeat
    wait 0
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 0
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 1
    wait 120
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
until 0AB0:   key_pressed 123

067F: set_car 0@ lights 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 3
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
Car.RemoveReferences(0@)
while 0AB0:   key_pressed 123
    wait 0
end 
return

Re: O script só é ativado se o jogador estiver dentro de algum veículo

Enviado: 26 Out 2018, 20:36
por MCHammer
HybridTheory escreveu:
26 Out 2018, 19:30
SpoilerAbrir

Código: Selecionar tudo

{$CLEO}
0000:

while true
    wait 0
    if and
    Actor.Driving($PLAYER_ACTOR)
    847A:   not actor $PLAYER_ACTOR driving_bike
    84A7:   not actor $PLAYER_ACTOR driving_boat
    84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle
    not Actor.DrivingVehicleType($PLAYER_ACTOR, #BMX)
    then
        if 0AB0:   key_pressed 123
        then
            0@ = Actor.CurrentCar($PLAYER_ACTOR)
            0A97: 1@ = car 0@ struct
            1@ += 1440
            067F: set_car 0@ lights 2
            gosub @STROBOS_FLASHING
            while 0AB0:   key_pressed 123
                wait 0
            end
        end
    end
end

:STROBOS_FLASHING
repeat
    wait 0
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 0
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 1 1
    wait 120
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
    0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
until 0AB0:   key_pressed 123

067F: set_car 0@ lights 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 3
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 0
0AA6: call_method 7086336 struct 1@ num_params 2 pop 0 0 1
Car.RemoveReferences(0@)
return
 
Thank you, lindão <3