IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Car NAvigation

 An Buggy Script (beggin for quick fix)
 
kiffz  
Posted: Saturday, Apr 14 2012, 18:10
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 14, 2012

XXXXX



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


PM
  Top
 

 
The_Sorrow  
Posted: Saturday, Apr 14 2012, 18:19
Quote Post


Heaven, I'm in heaven(8)
Group Icon
Group: Members
Joined: May 31, 2010

en.gif

XXXXX



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 icon14.gif
Users WebsitePMMSN
  Top
 

 
Bad.boy!  
Posted: Saturday, Apr 14 2012, 18:22
Quote Post


SA modder
Group Icon
Group: Members
Joined: Jun 20, 2010

nl.gif

XXXXX



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

This post has been edited by Bad.boy! on Saturday, Apr 14 2012, 18:23
PM
  Top
 

 
kiffz  
Posted: Saturday, Apr 14 2012, 18:23
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 14, 2012

XXXXX



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)
PM
  Top
 

 
Bad.boy!  
Posted: Saturday, Apr 14 2012, 18:24
Quote Post


SA modder
Group Icon
Group: Members
Joined: Jun 20, 2010

nl.gif

XXXXX



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 biggrin.gif)


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
PM
  Top
 

 
Link2012  
Posted: Saturday, Apr 14 2012, 18:31
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



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!
PMMSN
  Top
 

 
kiffz  
Posted: Saturday, Apr 14 2012, 19:27
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 14, 2012

XXXXX



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
PM
  Top
 

 
kiffz  
Posted: Saturday, Apr 14 2012, 19:45
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 14, 2012

XXXXX



may i get some help please :/
PM
  Top
 

 
Bad.boy!  
Posted: Saturday, Apr 14 2012, 20:28
Quote Post


SA modder
Group Icon
Group: Members
Joined: Jun 20, 2010

nl.gif

XXXXX



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.
PM
  Top
 

 
kiffz  
Posted: Saturday, Apr 14 2012, 20:31
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 14, 2012

XXXXX



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
PM
  Top
 

 
kiffz  
Posted: Saturday, Apr 14 2012, 20:52
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 14, 2012

XXXXX



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? :(
PM
  Top
 

 
Link2012  
Posted: Saturday, Apr 14 2012, 21:02
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



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
PMMSN
  Top
 

 
kiffz  
Posted: Saturday, Apr 14 2012, 21:57
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Apr 14, 2012

XXXXX



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 wow.gif
Can you explain to me please, what i am doing, and what is wrong on that?
It would be really nice
PM
  Top
 

 
Deji  
Posted: Saturday, Apr 14 2012, 23:40
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



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 wow.gif
Can you explain to me please, what i am doing, and what is wrong on that?
It would be really nice

CODE
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).
Users WebsitePM
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG