Jump to content

Car NAvigation


kiffz

Recommended Posts

HI @ all, me again, i scripted another mod, which should navigate the Car to an Specified Target on the marker, two questions...

 

1. Why isn´t it working

2. If it would be working, will it work on SAMP?

 

 

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------wait 0:CARNAV_0if   Actor.Defined($PLAYER_ACTOR)else_jump @CARNAV_0jump @CARNAV_1 :CARNAV_1if and0ADC:   test_cheat "CNAV"   Actor.Driving($PLAYER_ACTOR)   not Actor.Dead($PLAYER_ACTOR)else_jump @CARNAV_14@ = 10.000BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1018C: play_sound 1058 at 0.0 0.0 0.0 jump @CARNAV_2:CARNAV_20AB6: store_target_marker_coords_to 1@ 2@ 3@03C0: 0@ = actor $PLAYER_ACTOR carif    Car.Defined(0@)else_jump @CARNAV_200AE: set_car 0@ traffic_behaviour_to 2 0423: set_car 0@ improved_handling_to 2.0Car.DriveTo(0@,1@,2@,3@)Car.SetSpeedInstantly(0@,4@)jump @CARNAV_3:CARNAV_3if0AB0: key_pressed 107else_jump @CARNAV_44@ += 10.0:CARNAV_4if0AB0: key_pressed 109else_jump @CARNAV_54@ -= 10:CARNAV_5if0AB0:   key_pressed 87else_jump @CARNAV_6Car.RemoveReferences(0@):CARNAV_6if 0AB0:   key_pressed 83else_jump @CARNAV_7Car.RemoveReferences(0@):CARNAV_7if 0ADC:   test_cheat "CNAV"else_jump @CARNAV_2Car.RemoveReferences(0@)jump @CARNAV_0

 

Link to comment
Share on other sites

Firstly, Whenever using If statements you must include a wait in there otherwise the game will crash

 

The label is ':CARNAV_0' and you are placing wait opcodes outside of this, Incorrect coding!

Place wait opcodes inside the labels with If statements, Always.

 

Also, You see here:

 

 

jump @CARNAV_1:CARNAV_1

 

 

The code automatically runs down the script meaning you don't have to guide its every move, A jump here isn't needed, Get rid.

 

Refurbished code:

 

 

{$CLEO .cs}0000::CARNAV_0wait 0if  Actor.Defined($PLAYER_ACTOR)jf @CARNAV_0:CARNAV_1wait 0if and0ADC:   test_cheat "CNAV"  Actor.Driving($PLAYER_ACTOR)  not Actor.Dead($PLAYER_ACTOR)jf @CARNAV_14@ = 10.000BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1018C: play_sound 1058 at 0.0 0.0 0.0:CARNAV_20AB6: store_target_marker_coords_to 1@ 2@ 3@03C0: 0@ = actor $PLAYER_ACTOR carwait 0if  Car.Defined(0@)jf @CARNAV_200AE: set_car 0@ traffic_behaviour_to 20423: set_car 0@ improved_handling_to 2.0Car.DriveTo(0@,1@,2@,3@)Car.SetSpeedInstantly(0@,4@):CARNAV_3wait 0if0AB0: key_pressed 107jf @CARNAV_44@ += 10.0:CARNAV_4wait 0if0AB0: key_pressed 109jf @CARNAV_54@ -= 10:CARNAV_5wait 0  if0AB0:   key_pressed 87jf @CARNAV_6Car.RemoveReferences(0@):CARNAV_6wait 0if0AB0:   key_pressed 83jf @CARNAV_7Car.RemoveReferences(0@):CARNAV_7wait 0 if0ADC:   test_cheat "CNAV"jf @CARNAV_2Car.RemoveReferences(0@)jump @CARNAV_0

 

 

Hope it works icon14.gif

Link to comment
Share on other sites

You forgot a lot of waits again...

It should work, but you'll drive on car paths and be an easy target. And if an admin sees you drive perfect like the AI and he is suspicious you're f*cked.

 

EDIT: To late again

Edited by Bad.boy!
Link to comment
Share on other sites

thank you very much, but one question left...

will it run at samp, for other players like me, or is it like, they wil see me enter the car and see me exitting it?

(sry for my bad english biggrin.gif)

Link to comment
Share on other sites

 

thank you very much, but one question left...

will it run at samp, for other players like me, or is it like, they wil see me enter the car and see me exitting it?

(sry for my bad english biggrin.gif)

 

 

You forgot a lot of waits again...

It should work, but you'll drive on car paths and be an easy target. And if an admin sees you drive perfect like the AI and he is suspicious you're f*cked.

 

EDIT: To late again

 

Finally I can use multiquote for a reason

Link to comment
Share on other sites

 

Firstly, Whenever using If statements you must include a wait in there otherwise the game will crash

Nooo, This will just slows the script.

 

You only need a wait when: You need to wait a specific time OR when you should interrupt your script actions to game process other things, like ghapics rendering etc...

 

So, when you are in a loop that will take time you should use a wait, otherwise only your script will be processed, the rest of the game will be freeze until you use wait to say, Ok My work is done!

Link to comment
Share on other sites

another bug i found... Why isn´t this part working:

 

Here is the Part with the bug

 

:CARNAV_76@ = Car.Health(0@) wait 0if or 01F3:   car 0@ in_air5@ >= 6@                     // TO absorb missunderstandins, this is the errored line of code... the compiler says,                                   // that i cannot compare those two variables                                   // and i´ve tested every possible comparisson operator :OCar.Wrecked(0@)jf @CARNAV_8Car.SetSpeedInstantly(0@,4@)wait 10 Car.SetSpeedInstantly(0@,0.0)Car.RemoveReferences(0@)

 

 

This is the full Script, in which it fits into

 

{$CLEO .cs}0000::CARNAV_0wait 0if Actor.Defined($PLAYER_ACTOR)jf @CARNAV_0:CARNAV_1wait 0if and0ADC:   test_cheat "CACA" Actor.Driving($PLAYER_ACTOR) not Actor.Dead($PLAYER_ACTOR)jf @CARNAV_14@ = 10.000BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1018C: play_sound 1058 at 0.0 0.0 0.0:CARNAV_20AB6: store_target_marker_coords_to 1@ 2@ 3@03C0: 0@ = actor $PLAYER_ACTOR car5@ = Car.Health(0@)wait 0if Car.Defined(0@)jf @CARNAV_200AE: set_car 0@ traffic_behaviour_to 20423: set_car 0@ improved_handling_to 2.0Car.DriveTo(0@,1@,2@,3@)Car.SetMaxSpeed(0@, 4@)Car.SetSpeedInstantly(0@,4@):CARNAV_3wait 0if0AB0: key_pressed 107jf @CARNAV_44@ += 10.0jump @CARNAV_2:CARNAV_4wait 0if0AB0: key_pressed 109jf @CARNAV_54@ -= 10jump @CARNAV_2:CARNAV_5wait 0  if0AB0:   key_pressed 87jf @CARNAV_6Car.RemoveReferences(0@):CARNAV_6wait 0if0AB0:   key_pressed 83jf @CARNAV_7Car.RemoveReferences(0@):CARNAV_76@ = Car.Health(0@) wait 0if or 01F3:   car 0@ in_air5@ >= 6@ Car.Wrecked(0@)jf @CARNAV_8Car.SetSpeedInstantly(0@,4@)wait 10 Car.SetSpeedInstantly(0@,0.0)Car.RemoveReferences(0@):CARNAV_8wait 0if    4@ > 150.0jf @CARNAV_94@ -= 10.0jump @CARNAV_2:CARNAV_9wait 0 if0ADC:   test_cheat "CACA"jf @CARNAV_2Car.RemoveReferences(0@)jump @CARNAV_1

 

 

and the next question is following: How do i detect, if my car collides with a building, latern or so on, bcause, i use SetSpeedInstantly, and this is gay, because if my car crashes to another car or house or whatever, it starts to fly, and it should not fly, on an RL SAMP server

 

I think i can make this up, with the Car Damage, but i cannot compare the Car Damage Values, as you See.

May Someone wants to help me, makin this Mod 100% FUD for Admins? Expect the Driving on Carpaths, this is impossible to change...

Edited by kiffz
Link to comment
Share on other sites

No one will help you cheating on samp.

And that part doesn't work, because you removed refrences to the car.

 

And have some more more patient. We don't have to help you.

Link to comment
Share on other sites

i know, that wasn´t an order, it was a question, sry it wasn´t ment, like you understood :O

 

another missunderstanding, no everything works, exept this comparisson with 5@ and 6@, and i dont know why, but it seems to be the '<' operator or the, but all of those smaller / greater operators don´t work at this line of code, a few lines beyond i used the '>' operator, and it works perfectly :O

Edited by kiffz
Link to comment
Share on other sites

Now the Operator should work, but it doesn´t

 

 

{$CLEO .cs}0000::CARNAV_0wait 0if Actor.Defined($PLAYER_ACTOR)jf @CARNAV_0:CARNAV_1wait 0if and0ADC:   test_cheat "CACA" Actor.Driving($PLAYER_ACTOR) not Actor.Dead($PLAYER_ACTOR)jf @CARNAV_14@ = 10.000BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1018C: play_sound 1058 at 0.0 0.0 0.0:CARNAV_20AB6: store_target_marker_coords_to 1@ 2@ 3@03C0: 0@ = actor $PLAYER_ACTOR car5@ = Car.Health(0@)wait 0if Car.Defined(0@)jf @CARNAV_200AE: set_car 0@ traffic_behaviour_to 20423: set_car 0@ improved_handling_to 2.0Car.DriveTo(0@,1@,2@,3@)Car.SetMaxSpeed(0@, 4@)Car.SetSpeedInstantly(0@,4@):CARNAV_3wait 0if0AB0: key_pressed 107jf @CARNAV_44@ += 10.0jump @CARNAV_2:CARNAV_4wait 0if0AB0: key_pressed 109jf @CARNAV_54@ -= 10jump @CARNAV_2:CARNAV_5wait 0  if0AB0:   key_pressed 87jf @CARNAV_6Car.RemoveReferences(0@)jump @CARNAV_1:CARNAV_6wait 0if0AB0:   key_pressed 83jf @CARNAV_7Car.RemoveReferences(0@)jump @CARNAV_1:CARNAV_76@ = Car.Health(0@) wait 0if or 01F3:   car 0@ in_airnot 5@ > 6@   // This operation lets the compiler respond with an error: Unknown Expression One of those Variables has an incompatible type or the Operator does not exist - WHY?!Car.Wrecked(0@)jf @CARNAV_8Car.SetSpeedInstantly(0@,4@)wait 10 Car.SetSpeedInstantly(0@,0.0)Car.RemoveReferences(0@)jump @CARNAV_1:CARNAV_8wait 0if    4@ > 150.0jf @CARNAV_94@ -= 10.0jump @CARNAV_2:CARNAV_9wait 0 if0ADC:   test_cheat "CACA"jf @CARNAV_2Car.RemoveReferences(0@)jump @CARNAV_1

 

 

Can Someone Help me please? :(

Link to comment
Share on other sites

Because you should say to the compiler the variable type (Int\Float\String), so it can get the right opcode.

 

Read Sanny Builder Help > Coding > Variables

Link to comment
Share on other sites

 

Because you should say to the compiler the variable type (Int\Float\String), so it can get the right opcode.

            Read Sanny Builder Help > Coding > Variables

 

 

Thank you very much, but i do not get more intelligent out of this, this is makin me a bit confused wow.gif

Can you explain to me please, what i am doing, and what is wrong on that?

It would be really nice

Link to comment
Share on other sites

Because you should say to the compiler the variable type (Int\Float\String), so it can get the right opcode.

            Read Sanny Builder Help > Coding > Variables

 

 

Thank you very much, but i do not get more intelligent out of this, this is makin me a bit confused wow.gif

Can you explain to me please, what i am doing, and what is wrong on that?

It would be really nice

 

not 5@ > 6@

 

 

Sanny doesn't know whether you're comparing floats or integers. So it doesn't know which opcode to use. You can either enter the correct opcode manually or define the variables types (as Link2012 said, read SB's help documentation).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.