hello, i changed to text since i'm too lazzy to make a video.
let's start << i will explain the first code too so you guys can follow if you didn't understand the video:
so here is our last script:
explaining the codes:
so now we now that we have to put these two lines before starting codes to avoid crashes:
and this is how we comment and make notes :
now to start with the real codes , we have to use labels , and labels is kinda a big function contain many inner functions that will run one by one ,, and labels will be read one by one by sanny/gta but we can customize the run process too
now if we want to make 2 or more conditions we replace "IF" with "IF AND" like this:
new stuff:
but now we need more controls , we want to active and deactivate using two different keys. and we can do it with 2 labels easily .
but we can make it in another way too:
this is the tricky one , it is easy and very useful and i recommended you understand it:
now you learned much stuff
that's all i have for you today , if you have any question , even half a question or stupid one or if you didn't understand a step , then ask me , i will explain it to you again with slower process
i recommended you to read it again after you finished so you understand everything
the full codes without explanations:
the easy one:
the tricky one:
you can make a single line comment:
Or a whole part commented:
so the comment opener is " { " and the closer is " } " they both called curly braces
thank you for following my tutorial.
PS: if i wrote something wrong please comment it , because i made a full tutorial but ugbase required me to login again , so i lost the whole thing ....
so i typed it all over again, and i'm too sleepy so maybe i forgot something
edit: this is a link for activation keys >> http://ugbase.eu/tutorials/how-to-change-the-activation-keys-on-a-cleo-script/
in the next tutorial i will explain more about it and how to use different keys in different ways.
let's start << i will explain the first code too so you guys can follow if you didn't understand the video:
so here is our last script:
Code:
{$CLEO}
0000: NOP
// this is comment ...
{this
is
comment
also
}
:MAIN
wait 0
if and
056D: actor $PLAYER_ACTOR defined
0AB0: 49 //key 1 pressed?
jf @MAIN
0332: set_actor $PLAYER_ACTOR bleeding 1
jump @MAIN
explaining the codes:
so now we now that we have to put these two lines before starting codes to avoid crashes:
Code:
{$CLEO}
0000: NOP
and this is how we comment and make notes :
Code:
//this is comment and won't be read by sanny/gta
now to start with the real codes , we have to use labels , and labels is kinda a big function contain many inner functions that will run one by one ,, and labels will be read one by one by sanny/gta but we can customize the run process too
Code:
:MAIN
//so we started with the label MAIN < we can name labels anything
//now under this we have our codes that will run ,But before we start putting codes we have to add:
wait 0
// this will avoid crashing
//now after this we start with "if" statement , and if statement is like (if this/these conditions equaled to true
//then run the below code ,, if not the jump [member=23507]Label[/member]) , basically 50% of cleo is "if" statement , and it is pretty
//easy but tricky.
//now we add our "if" statment:
if
0AB0: 49 //key 1 pressed? // now this is our conditions if it true it will set actor bleeding to on.
jf @MAIN //if not it will jump @MAIN.as you saw (jf @MAIN) is a shorter statement of (jump_if_false @MAIN)
// now we said @MAIN so the code loop for ever until you pressed 1 , or close the game :)
0332: set_actor $PLAYER_ACTOR bleeding 1 //if the conditions = true , then this code will run and make actor bleeding
jump @MAIN // now we said @MAIN so the code will go back to the start and loop for ever until you pressed 1 , or close the game.
now if we want to make 2 or more conditions we replace "IF" with "IF AND" like this:
Code:
if and // with "if and" we have 2 or more conditions and both must equal to true !
056D: actor $PLAYER_ACTOR defined //define the actor , if not equal to true the code will be bypass and
//jump at main again , thanks to jf @MAIN
0AB0: 49 //key 1 pressed? // if key pressed 1 the script will run the codes under "jf @main" if not then it will
//bypass and go back to main
jf @MAIN // so this is a backup plan , if the conditions is false , we won't crash , but we will go up and loop
//again to check if you pressed 1
0332: set_actor $PLAYER_ACTOR bleeding 1 // set bleeding state on/active
jump @MAIN // after everything finished , this code will let us jump at main (@MAIN) again so we loop
//forever until you close the game
new stuff:
but now we need more controls , we want to active and deactivate using two different keys. and we can do it with 2 labels easily .
Code:
{$CLEO}
0000: NOP
// this is comment ...
:MAIN // our first label , this will run first , and active the bleed
wait 0 // avoid crashes and freezing we have to wait in milliseconds
if and // for 2 or more conditions we use "if and"
056D: actor $PLAYER_ACTOR defined // our first condition
0AB0: 49 //key 1 pressed? //our second condition
//there is no problem with sorting the conditions ,, it will run all , so if we put key press first then actor define
//won't be a problem :)
jf @MAIN // as we said our backup plan XD
0332: set_actor $PLAYER_ACTOR bleeding 1 //active bleeding state , 1 = on
jump @second //now this will change from main to second so we jump to the next label to check for other
//codes and conditions , if we make it @MAIN , then label second won't be read since there is no redirect for
//it in label main
:second // our next label to stop the bleed
wait 0 // avoid crashing and freezing
if // for 1 condition
// no need to define the actor , because from the first step we add the condition for it , and if it is not equal to true it will go to main again until it became true :)
0AB0: 50 //key 2 pressed? // key 2 press = off
jf @second // so if we pressed another key it will go to second again and it will loop in label second until you
//press 2 to stop bleeding ,, this can be changed from script to another ,, some people want to jump
//@MAIN again so they don't stick in @Second label , and run the codes in label main again .
0332: set_actor $PLAYER_ACTOR bleeding 0 // 0 = off , deactivate the bleeding
jump @MAIN // here we make it @MAIN so we loop again from the start after everything finished
but we can make it in another way too:
this is the tricky one , it is easy and very useful and i recommended you understand it:
Code:
:MAIN // our first label , this will run first , and active the bleed
wait 0 // avoid crashes and freezing we have to wait in milliseconds
if and // for 2 or more conditions we use "if and"
056D: actor $PLAYER_ACTOR defined // our first condition
0AB0: 49 //key 1 pressed? //our second condition
//there is no problem with sorting the conditions ,, it will run all , so if we put key press first then actor define
//won't be a problem :)
jf @second // now we changed from MAIN to second , this will be like this , (if actor is defined and key pressed is 1 then run the code below , if the conditions not equal to true then jump at second so we check the codes there) and this will lead to many new changes :P
0332: set_actor $PLAYER_ACTOR bleeding 1 //active bleeding state , 1 = on
jump @MAIN// since we cover label second with "jf" statement above , we have to jump at main after this , so if the conditions are true the codes will run and then it will jump again @MAIN again to loop forever.
:second // our next label to stop the bleed
wait 0 // avoid crashing and freezing
if and // for 2 or more conditions
056D: actor $PLAYER_ACTOR defined //we need to define the actor , because if the label MAIN failed with defining the actor and jumped to the second label , we need to require GTA to define the actor in label second too , so we don't get crash.
0AB0: 50 //key 2 pressed? // key 2 press = off
jf @MAIN // so if we pressed another key it will go to MAIN again and loop there until you press one of the
//keys (1 or 2), (so if we didn't press 1 in the first step it will jump at second and it will check if we pressed 2
//but if we didn't then it will go to main and check if we pressed 1 again, this will loop forever until you close
//the game or smash on of the keys heh
0332: set_actor $PLAYER_ACTOR bleeding 0 // 0 = off , deactivate the bleeding
jump @MAIN // here we make it @MAIN so we loop again from the start after everything finished
now you learned much stuff
that's all i have for you today , if you have any question , even half a question or stupid one or if you didn't understand a step , then ask me , i will explain it to you again with slower process
i recommended you to read it again after you finished so you understand everything
the full codes without explanations:
the easy one:
Code:
{$CLEO}
0000: NOP
// this is comment ...
:MAIN
wait 0
if and
056D: actor $PLAYER_ACTOR defined
0AB0: 49 //key 1 pressed?
jf @MAIN
0332: set_actor $PLAYER_ACTOR bleeding 1
jump @second
:second
wait 0
if
0AB0: 50 //key 2 pressed?
jf @second
0332: set_actor $PLAYER_ACTOR bleeding 0
jump @MAIN
the tricky one:
Code:
{$CLEO}
0000: NOP
// this is comment ...
:MAIN
wait 0
if and
056D: actor $PLAYER_ACTOR defined
0AB0: 49 //key 1 pressed?
jf @second
0332: set_actor $PLAYER_ACTOR bleeding 1
jump @MAIN
:second
wait 0
if and
056D: actor $PLAYER_ACTOR defined
0AB0: 50 //key 2 pressed?
jf @MAIN
0332: set_actor $PLAYER_ACTOR bleeding 0
jump @MAIN
you can make a single line comment:
Code:
// this is comment
Code:
{this
is
comment
also
}
thank you for following my tutorial.
PS: if i wrote something wrong please comment it , because i made a full tutorial but ugbase required me to login again , so i lost the whole thing ....
so i typed it all over again, and i'm too sleepy so maybe i forgot something
edit: this is a link for activation keys >> http://ugbase.eu/tutorials/how-to-change-the-activation-keys-on-a-cleo-script/
in the next tutorial i will explain more about it and how to use different keys in different ways.