Register coords of player and do something about them

hello, today i will explain how to register coords and do something with it :)


ok so here is our code:

Code:
{$cleo}

0000:

:first
wait 0
if and       // our conditions keyword
056D:   actor $PLAYER_ACTOR defined    //define the actor 
0AB0:   key_pressed 115 //f4 
jf @second
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
jump @second


:second
wait 0 
if and       // our conditions keyword
056D:   actor $PLAYER_ACTOR defined    //define the actor 
0AB0:   key_pressed 116 //f5 
jf @first
00A1: put_actor $PLAYER_ACTOR at 1@ 2@ 3@
jump @first


you may not understand everything now but i will explain it, but you may go to this tutorial to know more about "if" statement http://ugbase.eu/tutorials/4)more-about-if-statement-and-labels-tut/



explanation:
Code:
{$cleo}

0000:

:first
wait 0
if and       // our conditions keyword
056D:   actor $PLAYER_ACTOR defined    //define the actor 
0AB0:   key_pressed 115 //f4 
jf @second  // so here if our condition is wrong it will jump to the next label to check if that 
//label conditions equaled to true << if you remember the tricky "if" statement xD 
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@ // now this opcode will register 
//your position to variables X.Y.Z , this is very useful , if you don't know what var.(variables) 
//means , go to the below of this topic .
jump @second // after the croods registered it will jump to second 


:second 
wait 0 
if and       // our conditions keyword
056D:   actor $PLAYER_ACTOR defined    //define the actor 
0AB0:   key_pressed 116 //f5 different key not f4!
jf @first  //we explain this in if statement tutorial , if you don't know this , i put a link in the start
//of the topic
00A1: put_actor $PLAYER_ACTOR at 1@ 2@ 3@ //here , we registered the coords to the variables (1@ 2@ 3@) before , and now we will use it again , but to put actor at this variables 
jump @first

now let's assume , our coords is156.2 173 25.8

now X = 156.2 , Y = 173 , Z = 25.8,, << these conditions are comparing to (0,0,0) which is the first place made in gta (the center of the world) that's how we got these numbers, now these XYZ will register one by one to variables which is 1@ 2@ 3@ ,, so 1@ = x , 2@ = y , 3@ = z



pretty easy ha?
yes we just made a basic teleport hack , that store your position in some point when you press f4 and then when you press f5 it will put you again at that position.. , you may play with it more and adjust it and add more conditions like if you are in car or something << this is very useful i learned by this way xD




PS:
1)variables In computer programming, a variable or scalar is a storage location and an associated symbolic name (an identifier) which contains some known or unknown quantity or information, a value. The variable name is the usual way to reference the stored value --source Wikipedia

in another words , variables is store(hold) specific values to a symbols just like X and Y we learned in school like
x = 2
y = 4

x*y = 8

===============================
3)all numbers followed by "@" sign are variables
===============================
4)everything begin with "$" sign is variable too
but with "$" we can use letters too not just numbers like ($PLAYER_ACTOR) it is known as global vars. (we can use it in more than one thread(0000:) but it is known as slow and laggy too)


-----------------------------------------------------

if you didn't understand a point in the tutorial , please comment so i can explain it more for you


if i helped you don't forgot to hit the thanks button :)

thanks for following my tutorials.
 

NoJustNo

Active member
Joined
Jul 26, 2014
Messages
178
Reaction score
0
Re: 7)register coords of player and do something about -TUT

damn i needed this . thx alot.
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: 7)register coords of player and do something about -TUT

I know you did xD this is just like a free basic open source teleport hack :) enjoy
 

NoJustNo

Active member
Joined
Jul 26, 2014
Messages
178
Reaction score
0
Re: 7)register coords of player and do something about -TUT

and here's one for returning where you where before teleporting:


Code:
{$cleo}

0000:

:first
wait 0
if and       // our conditions keyword
056D:   actor $PLAYER_ACTOR defined    //define the actor 
0AB0:   key_pressed 115 //f4 
jf @second
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
0ACD: show_text_highpriority "~r~Position ~b~Saved" time 1500
jump @second


:second
wait 0 
if and       // our conditions keyword
056D:   actor $PLAYER_ACTOR defined    //define the actor 
0AB0:   key_pressed 116 //f5 
jf @third
00A0: store_actor $PLAYER_ACTOR at 4@ 5@ 6@
wait 0
00A1: put_actor $PLAYER_ACTOR at 1@ 2@ 3@
0ACD: show_text_highpriority "~r~TELEPORTED" time 1500
jump @third

:third
wait 0
if and
056D:   actor $PLAYER_ACTOR defined    //define the actor 
0AB0:   key_pressed 118 //f7
jf @first
00A1: put_actor $PLAYER_ACTOR at 4@ 5@ 6@
0ACD: show_text_highpriority "~r~RETURNED" time 1500 
jump @first

Please tell me if i did something wrong.
 

NoJustNo

Active member
Joined
Jul 26, 2014
Messages
178
Reaction score
0
Re: 7)register coords of player and do something about -TUT

And By the way , include repeat condition and how to save stuff in txt or browse stuff from ini files and some commands come like 01A9: (variable) (variable) or something , explain that too , if possible , thx alot .
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: 7)register coords of player and do something about -TUT

Nice work  i'm impressed  :surprised:
You learn fast heh
I will do a tutroials for it later xD when i have time .
 

NoJustNo

Active member
Joined
Jul 26, 2014
Messages
178
Reaction score
0
Re: 7)register coords of player and do something about -TUT

blackHat link said:
Nice work  i'm impressed  :surprised:
You learn fast heh
I will do a tutroials for it later xD when i have time .

well , i wish to be scripter ... so yea , i like scripting alot , and i was gonna become a game maker or something when i grow up so , im so thankfull that im learning to script...
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,126
Solutions
1
Reaction score
158
Re: 7)register coords of player and do something about -TUT

Are you planning to do some more tutorials?
 

@WZ

Active member
Joined
Aug 3, 2014
Messages
25
Reaction score
1
Re: 7)register coords of player and do something about -TUT

Great work as always, thank u.
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: 7)register coords of player and do something about -TUT

monday link said:
Are you planning to do some more tutorials?

ofcourse ,

why i take so long to make a tutorial:
sorry for taking long heh,please remember that i started this tutorial series because i wont be available for a huge time after some months  , so i'm sure i will forgot 70% of what i know, so i want to make a backup plan for me ( securing my brain data) so i don't lost it when the final exams came :'( , so i thought to share what  i know with others while securing and do something good for our great community , if i took long is because i'm very busy with real life, after all i will leave CLEO scripting or not idk , tutorial may take different times to be written since i don't have time


@WZ link said:
Great work as always, thank u.

thank you :)
 

Diaboloiro_xd

Member
Joined
Feb 19, 2013
Messages
6
Reaction score
0
Re: 7)register coords of player and do something about -TUT

I have a question about local variable @
I create

thread "name"
: name_main
@ 0 = 3
...
: name_command
: name_etc
end_custom_thread

I have 0 on @ name_main, she will have the same value in name_command and name_etc? Or each @ 0 will have a different value?

In 0AB1: name_command first stop 5
@ variable to 0 will make reference only name_command without modifying the value of the variable @ 0, the name_main, or will change the value of the name_main 0 [member=23184]?[/member]

@ 0 is reachable, while not end_custom_thread?

Thank you, sorry my bad english, do not speak English.
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: 7)register coords of player and do something about -TUT

i didn't understand you , but :

the variable "@" comes after the number (0@) not before the number

no need to use threads , unless it is a big project


yes "@" is a local variable that belong to the thread that it is(the variable) in it(in the thread)

by ending the thread , the variables will be cleared, like:
adding a local variable in thread FIRST
Code:
thread "first"
0@ = 3
 end_custom_thread

now we can use 0@ again in the next thread
Code:
thread "second"
0@ = 4
 end_custom_thread

now 0@ in thread "second" won't replace the variable in thread "first"


and yes 0@ is reachable while you don't end the thread , so if you declare:


Code:
thread "name" 
0@ = 3

then in the same thread you said
Code:
0@ = 6

this will replace 3 with 6 , so the new value will be stored in variable 0@ is 6


but you cant use another thread if you don't close the one before it

thank you for following me .
 

Diaboloiro_xd

Member
Joined
Feb 19, 2013
Messages
6
Reaction score
0
Re: 7)register coords of player and do something about -TUT

Thank you very BlackHat, his explanation was exellent, @0 bug translator. Original 0@.

Great tutorials, thanks again, sorry my bad english.
 

blackHat

Expert
Joined
Jul 28, 2013
Messages
930
Reaction score
2
Re: 7)register coords of player and do something about -TUT

Diaboloiro_xd link said:
Thank you very BlackHat, his explanation was exellent, @0 bug translator. Original 0@.

Great tutorials, thanks again, sorry my bad english.

you're totally welcome :)

no problem , i'm not good in english either xD

thank you for following my tutorials
 
Top