First Steps in Cleo scripting with Sannybuilder

  1. Download newest version of Sannybuilder from Seeman at
  2. www.sannybuilder.com
  3. Install Sannybuilder and create a folder for your scripts
    Therefor youre promt to indicate your GTASA-Install dir.
  4. Then start Sannybuilder and open a new blank page, copy the script below and insert it into the new page.
  5. {$CLEO .cs}
    :DEMOTEXT
    03A4: name_thread "DEMO"
    wait 1000
    
    :DEMOTEXT_1
    wait 0
    if
    0256:   player $PLAYER_CHAR defined 
    004D: jump_if_false @DEMOTEXT_1
    if
    00E1:   key_pressed  0  17
    004D: jump_if_false @DEMOTEXT_1
    00BA: text_styled 'FEM_OK'  1000 ms  1
    0A93: end_custom_thread

  6. Save it in your Sannyscript folder and give it a name.
  7. Compile the script. Click on menue icon with "running man" to choose compile + copy
  8. If the CLEO - Library is installed, the script will be compiled and copied into GTASA\CLEO - folder
  9. The Cleo script file get then the file extension, which is written in the Cleo Script directive at the beginning of the script
  10. {$CLEO .cs} = Cleo-Direktive, will be compiled to *.cs
  11. As DEMOTEXT.txt saved and compiled as DEMOTEXT.cs

  12. If CLEO is not installed, then sannybuilder will prompt you to do it and at the lower right corner of the editor
    appears the CLEO - box with a red border. Click on it and Sannybuilder installs Cleo immediately.
    Or go here: Cleo Basics to view a detailed instruction.


  13. If the compiling process was successful you get then a report message
  14. click on OK to confirm
    the lower value "Largest Script" shows the script file size
    the other values belongs to a compiling process of a main.scm

  15. Test then the script ingame, press fire button to display the text message OK
  16. The script ends then, will be deactivated because it ends with opcode 0A93: end_custom_thread
  17. 0A93: end_custom_thread was created for Cleo, Use this code in .CS script files
    In opposite to Rockstars version 004E: end_thread in the main.scm
    Extra Cleo opcodes can be found in Sannybuilder HELP: CLEO 3 Code Library >> CLEO 3: opcodes
  18. also look for Special Particularities in Cleo
  19. The next step should teach you now the basics like about the Editor and Data types
  20. or play first around and place parked cars, scroll down to look how to do
  21. Editor Functions
  22. Reading Coordinates of player poisition
  23. DATA TYPE MEANING
  24. The Opcode

Placing Cars by Using Parked_Car_Generator and Weapon Pickups

  1. Init parked_car_generators or pickups need to insert the Cleo opcode:
  2. 0A95: enable_thread_saving
  3. The Cleo scripts with extension .cs are started allways from new by loading a save game or start new game,
    If such a script includes for exemble a parked car generator and execute it and after this a save game is made,
    and then this save game is loaded,
    will be created a duplicate of the item, in this case a duplicate of a parked car generator.
    This happens with parked car generator, pickups as well as placed objects.
    use 0A95: enable_thread_saving to prevent such a failure
    it instruct Cleo to store the script state by making a savegame

  4. Script below adds a parked_car_generator to spawn the car Banshee
  5. and a weapon pickup with MINIGUN
  6. {$CLEO .cs}
    :PaCar_1
    03A4: name_thread "PACR"
    0001: wait  1000 ms
    0A95: enable_thread_saving
    
    014B: 1@ = init_parked_car_generator #BANSHEE -1 -1  1 alarm  0 door_lock  0  0  10000 at  920.1994  2020.546  11.79 angle  100.0
    014C: set_parked_car_generator 1@ cars_to_generate_to  101
    
    032B: 2@ = create_weapon_pickup #MINIGUN  15 ammo  5000 at  2113.373 1520.674  10.82
    
    0A93: end_custom_thread


  7. description of parked car codes

parked cars requires 2 code lines

1. the opcode to define the vehicel

    014B: 1@ = init_parked_car_generator #PCJ600 0 17 1 alarm 0 door_lock 0 0 10000 at 2490.0 -1682.0 13.5 angle 90.0

 

2. the opcode to enable the parked car function

    014C: set_parked_car_generator 1@ cars_to_generate_to 101

generate_to 101 means that the car will be spawned again and again
generate_to 0 deactivates the car_generator

the opcode definition in detail

014B: is the opcode to execute the function

1@ is the variable name to registrate the instance of the generator

#PCJ600 is the file name of the model,
# (hash) marks the connected entry as filename of a loadable model

You can also use the ID-number without writing # (hash), like below

    //--with ID-number:
    014B: 1@ = init_parked_car_generator 461 0 17 1 alarm 0 door_lock 0 0 10000 at 2490.0 -1682.0 13.5 angle 90.0
    
    //--with filename
    014B: 1@ = init_parked_car_generator #PCJ600 0 17 1 alarm 0 door_lock 0 0 10000 at 2490.0 -1682.0 13.5 angle 90.0

filename or ID number must exist in VEHICLES.IDE

the two parameters after the model name 0 17 gives the secondary and primary color

by setting 0 17 it give black 0 to primary


and red 17 to secondary color


by setting -1 the game choose the colors randomly


alarm 0 can be a value between 0 and 100 and means the probable chance to execute an alarm

door_lock 0 can be a value between 0 and 100 and means the probable chance to execute a door lock

the last 4 params at 2490.0 -1682.0 13.5 angle 90.0 are x y z -coords and z-angle for the placement

only floating points values are allowed
and no comma but a dot
(using classes without opcodes needs to insert commas between the coord entries but not inside the floating points values)

at 2490.0 -1682.0 13.5
means
at X-coordinate Y-coordinate Z-coordinate

angle 90.0 ,valid values for the angle alignment are between 0.0 and 360.0 degrees



  1. description of pickup opcodes

For pickups exist 2 different opcodes for 2 different kinds of pickups

032B: for weapons with ammo and for the Jetpack

0213: for melee weapons and objects like parachute (GUN_PARA) or bodyarmour (1242, bodyarmour)

    032B: 2@ = create_weapon_pickup #AK47 15 ammo 3000 at 2490.0 -1662.0 13.5
    
    0213: 3@ = create_pickup #gun_para type 15 at 2494.0 -1662.0 13.5

032B: or 0213: is the opcode to execute the function

2@ and 3@ is the variable name to registrate the instance of the

#AK47 is the file name of the model,
# (hash) marks the connected entry as filename of a loadable model

You can also use the ID-number without writing # (hash), like below

    //--with ID-number:
    032B: 2@ = create_weapon_pickup 355 15 ammo 3000 at 2490.0 -1662.0 13.5
    
    //--with filename
    032B: 2@ = create_weapon_pickup #AK47 15 ammo 3000 at 2490.0 -1662.0 13.5

filename or ID number of weapons must exist in DEFAULT.IDE

For Cleo can only be used model names which are defined in vehicles.ide, peds.ide, default.ide or vehmods.ide
Other models needs to use their ID number
gun_para for exemple is available in default.ide
but health, pickupsave and armour are defined in data\maps\generic\dynamic.ide
and need to insert the ID number

the parameter after the model ID #AK47 15 is the pickup-typ
Typ 15 is a pickup, which appears again and again
Typ 3 is a pickup, which appears only for one time

the parameter ammo 3000 gives the amount of ammo
99999 is maximum


the last 4 params at 2490.0 -1662.0 13.5 are x y z -coords and z-angle for the placement

only floating points values are allowed
and no comma but a dot
(using classes without opcodes needs to insert commas between the coord entries but not inside the floating points values)

at 2490.0 -1682.0 13.5
means
at X-coordinate Y-coordinate Z-coordinate


nothing