|
 |
|
|
|
|
|
GTA Modification Forums
Car NAvigation An Buggy Script (beggin for quick fix)
 |
|
 |
| |
kiffz  |
Posted: Saturday, Apr 14 2012, 18:10
|
Player Hater

Group: Members
Joined: Apr 14, 2012

|
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? | CODE | // 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_0 if Actor.Defined($PLAYER_ACTOR) else_jump @CARNAV_0 jump @CARNAV_1
:CARNAV_1 if and 0ADC: test_cheat "CNAV" Actor.Driving($PLAYER_ACTOR) not Actor.Dead($PLAYER_ACTOR) else_jump @CARNAV_1 4@ = 10.0 00BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1 018C: play_sound 1058 at 0.0 0.0 0.0 jump @CARNAV_2
:CARNAV_2 0AB6: store_target_marker_coords_to 1@ 2@ 3@ 03C0: 0@ = actor $PLAYER_ACTOR car if Car.Defined(0@) else_jump @CARNAV_2 00AE: set_car 0@ traffic_behaviour_to 2 0423: set_car 0@ improved_handling_to 2.0
Car.DriveTo(0@,1@,2@,3@) Car.SetSpeedInstantly(0@,4@) jump @CARNAV_3
:CARNAV_3 if 0AB0: key_pressed 107 else_jump @CARNAV_4 4@ += 10.0
:CARNAV_4 if 0AB0: key_pressed 109 else_jump @CARNAV_5 4@ -= 10
:CARNAV_5 if 0AB0: key_pressed 87 else_jump @CARNAV_6 Car.RemoveReferences(0@)
:CARNAV_6 if 0AB0: key_pressed 83 else_jump @CARNAV_7 Car.RemoveReferences(0@)
:CARNAV_7 if 0ADC: test_cheat "CNAV" else_jump @CARNAV_2 Car.RemoveReferences(0@) jump @CARNAV_0
|
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
The_Sorrow  |
Posted: Saturday, Apr 14 2012, 18:19
|
Heaven, I'm in heaven(8)

Group: Members
Joined: May 31, 2010


|
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:
| CODE | 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:
| CODE | {$CLEO .cs} 0000:
:CARNAV_0 wait 0 if Actor.Defined($PLAYER_ACTOR) jf @CARNAV_0
:CARNAV_1 wait 0 if and 0ADC: test_cheat "CNAV" Actor.Driving($PLAYER_ACTOR) not Actor.Dead($PLAYER_ACTOR) jf @CARNAV_1 4@ = 10.0 00BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1 018C: play_sound 1058 at 0.0 0.0 0.0
:CARNAV_2 0AB6: store_target_marker_coords_to 1@ 2@ 3@ 03C0: 0@ = actor $PLAYER_ACTOR car wait 0 if Car.Defined(0@) jf @CARNAV_2 00AE: set_car 0@ traffic_behaviour_to 2 0423: set_car 0@ improved_handling_to 2.0 Car.DriveTo(0@,1@,2@,3@) Car.SetSpeedInstantly(0@,4@)
:CARNAV_3 wait 0 if 0AB0: key_pressed 107 jf @CARNAV_4 4@ += 10.0
:CARNAV_4 wait 0 if 0AB0: key_pressed 109 jf @CARNAV_5 4@ -= 10
:CARNAV_5 wait 0 if 0AB0: key_pressed 87 jf @CARNAV_6 Car.RemoveReferences(0@)
:CARNAV_6 wait 0 if 0AB0: key_pressed 83 jf @CARNAV_7 Car.RemoveReferences(0@)
:CARNAV_7 wait 0 if 0ADC: test_cheat "CNAV" jf @CARNAV_2 Car.RemoveReferences(0@) jump @CARNAV_0 |
Hope it works
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Bad.boy!  |
Posted: Saturday, Apr 14 2012, 18:24
|
SA modder

Group: Members
Joined: Jun 20, 2010


|
| QUOTE (kiffz @ Apr 14 2012, 18:23) | 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 ) |
| QUOTE (Bad.boy! @ Apr 14 2012, 18:22) | 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
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Link2012  |
Posted: Saturday, Apr 14 2012, 18:31
|
Wut?

Group: Members
Joined: Jan 30, 2011


|
| QUOTE | | 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!
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
kiffz  |
Posted: Saturday, Apr 14 2012, 19:27
|
Player Hater

Group: Members
Joined: Apr 14, 2012

|
another bug i found... Why isn´t this part working: Here is the Part with the bug | CODE | :CARNAV_7 6@ = Car.Health(0@) wait 0 if or 01F3: car 0@ in_air 5@ >= 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 :O Car.Wrecked(0@) jf @CARNAV_8 Car.SetSpeedInstantly(0@,4@) wait 10 Car.SetSpeedInstantly(0@,0.0) Car.RemoveReferences(0@)
|
This is the full Script, in which it fits into | CODE | {$CLEO .cs} 0000:
:CARNAV_0 wait 0 if Actor.Defined($PLAYER_ACTOR) jf @CARNAV_0
:CARNAV_1 wait 0 if and 0ADC: test_cheat "CACA" Actor.Driving($PLAYER_ACTOR) not Actor.Dead($PLAYER_ACTOR) jf @CARNAV_1 4@ = 10.0 00BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1 018C: play_sound 1058 at 0.0 0.0 0.0
:CARNAV_2 0AB6: store_target_marker_coords_to 1@ 2@ 3@ 03C0: 0@ = actor $PLAYER_ACTOR car 5@ = Car.Health(0@) wait 0 if Car.Defined(0@) jf @CARNAV_2 00AE: set_car 0@ traffic_behaviour_to 2 0423: set_car 0@ improved_handling_to 2.0 Car.DriveTo(0@,1@,2@,3@) Car.SetMaxSpeed(0@, 4@) Car.SetSpeedInstantly(0@,4@)
:CARNAV_3 wait 0 if 0AB0: key_pressed 107 jf @CARNAV_4 4@ += 10.0 jump @CARNAV_2
:CARNAV_4 wait 0 if 0AB0: key_pressed 109 jf @CARNAV_5 4@ -= 10 jump @CARNAV_2
:CARNAV_5 wait 0 if 0AB0: key_pressed 87 jf @CARNAV_6 Car.RemoveReferences(0@)
:CARNAV_6 wait 0 if 0AB0: key_pressed 83 jf @CARNAV_7 Car.RemoveReferences(0@)
:CARNAV_7 6@ = Car.Health(0@) wait 0 if or 01F3: car 0@ in_air 5@ >= 6@ Car.Wrecked(0@) jf @CARNAV_8 Car.SetSpeedInstantly(0@,4@) wait 10 Car.SetSpeedInstantly(0@,0.0) Car.RemoveReferences(0@)
:CARNAV_8 wait 0 if 4@ > 150.0 jf @CARNAV_9 4@ -= 10.0 jump @CARNAV_2
:CARNAV_9 wait 0 if 0ADC: test_cheat "CACA" jf @CARNAV_2 Car.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... This post has been edited by kiffz on Saturday, Apr 14 2012, 20:41
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
kiffz  |
Posted: Saturday, Apr 14 2012, 20:31
|
Player Hater

Group: Members
Joined: Apr 14, 2012

|
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
This post has been edited by kiffz on Saturday, Apr 14 2012, 20:38
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
kiffz  |
Posted: Saturday, Apr 14 2012, 20:52
|
Player Hater

Group: Members
Joined: Apr 14, 2012

|
Now the Operator should work, but it doesn´t | CODE | {$CLEO .cs} 0000:
:CARNAV_0 wait 0 if Actor.Defined($PLAYER_ACTOR) jf @CARNAV_0
:CARNAV_1 wait 0 if and 0ADC: test_cheat "CACA" Actor.Driving($PLAYER_ACTOR) not Actor.Dead($PLAYER_ACTOR) jf @CARNAV_1 4@ = 10.0 00BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1 018C: play_sound 1058 at 0.0 0.0 0.0
:CARNAV_2 0AB6: store_target_marker_coords_to 1@ 2@ 3@ 03C0: 0@ = actor $PLAYER_ACTOR car 5@ = Car.Health(0@) wait 0 if Car.Defined(0@) jf @CARNAV_2 00AE: set_car 0@ traffic_behaviour_to 2 0423: set_car 0@ improved_handling_to 2.0 Car.DriveTo(0@,1@,2@,3@) Car.SetMaxSpeed(0@, 4@) Car.SetSpeedInstantly(0@,4@)
:CARNAV_3 wait 0 if 0AB0: key_pressed 107 jf @CARNAV_4 4@ += 10.0 jump @CARNAV_2
:CARNAV_4 wait 0 if 0AB0: key_pressed 109 jf @CARNAV_5 4@ -= 10 jump @CARNAV_2
:CARNAV_5 wait 0 if 0AB0: key_pressed 87 jf @CARNAV_6 Car.RemoveReferences(0@) jump @CARNAV_1
:CARNAV_6 wait 0 if 0AB0: key_pressed 83 jf @CARNAV_7 Car.RemoveReferences(0@) jump @CARNAV_1
:CARNAV_7 6@ = Car.Health(0@) wait 0 if or 01F3: car 0@ in_air not 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_8 Car.SetSpeedInstantly(0@,4@) wait 10 Car.SetSpeedInstantly(0@,0.0) Car.RemoveReferences(0@) jump @CARNAV_1
:CARNAV_8 wait 0 if 4@ > 150.0 jf @CARNAV_9 4@ -= 10.0 jump @CARNAV_2
:CARNAV_9 wait 0 if 0ADC: test_cheat "CACA" jf @CARNAV_2 Car.RemoveReferences(0@) jump @CARNAV_1
|
Can Someone Help me please? :(
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
Deji  |
Posted: Saturday, Apr 14 2012, 23:40
|
Coding like a Rockstar!

Group: Members
Joined: Dec 24, 2007


|
| QUOTE (kiffz @ Saturday, Apr 14 2012, 21:57) | | QUOTE | 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  Can you explain to me please, what i am doing, and what is wrong on that? It would be really nice | 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).
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|