Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions


CLEO Events

Recommended Posts


There are somethings that are very difficult, or impossible even impossible to do in CLEO. Some of those are strictly related to the linear flow and/or time the script engines runs.

So I had this idea the other night, and I'm excited to put it in action: An callback/event system. Let's see how it turns out.


It's good to recall that the external scripts has a little bit of this, with them being triggered by objects and peds around. However I'm here more focused on events that are truly out of the control of the scripter.


This is a experimental project, there are no short term plans for an official release, but the source code will be available soon.

Feedback and ideas are very very truly welcome.

Currently, I've added the following opcodes:

0F70: is_event_available TYPE // Checks if this version of the plugin supports the event TYPE0F71: create_event_listener TYPE at LABEL EVENT_PARAMS... num_vars NUM_LABEL_VARS LABEL_VARS... store_to VAR0F72: destroy_event_listener HANDLE0F73: return_from_event RETURNS...

The callbacks will work in a coroutine fashion, you can WAIT on them and things like that.



// EVENT_RENDER2D.TXT// Why: Scripter has no directly control over the rendering time.{$CLEO}0000:0F71: create_event_listener 10 at @CallbackDraw2D ___ num_vars 1 CRGBA 0xFF0000FF store_to [email protected] true    wait 600000end// Draws the hand icon on the screen. :CallbackDraw2D//[email protected] = 0xFF0000FF // [email protected] = 640.0      // CRect::[email protected] = 480.0      // CRect::[email protected] = -0.5       // CRect::[email protected] = -0.5       // CRect::b0AC7: [email protected] = var [email protected] offset0AC7: [email protected] = var [email protected] offset0AA6: call_method 0x728350 {CSprite2d::Draw} struct 0xBAB1FC num_params 2 pop 0 rgba [email protected] coords [email protected] 0F73: return_from_event 0
// EVENT_SCRIPT_TERMINATE.TXT// Why: Sometimes you want to use unmanaged resources (e.g. some OS resource), but then you// remember you may leak th if the user new/load game because you didn't free the resource when// your script got killed. So here we go...{$CLEO}0000:{ The following only notifies about this script termination. }//0A9F: [email protected] = current_thread_pointer//0F71: create_event_listener 0 at @OnScriptTerminate script_pointer [email protected] num_vars 0 store_to [email protected]{ The following notifies about any script termination. }0F71: create_event_listener 0 at @OnScriptTerminate script_pointer 0 num_vars 0 store_to [email protected] true    wait 600000end:OnScriptTerminate// [email protected] is the currently terminating script [email protected] += 0x8 // now it is CRunningScript::szName[8]0AD3: [email protected] = format "TERMNT:%s" [email protected]   0662: printstring [email protected] // http://gtag.gtagaming.com/mods/81-sa-scrdebug/0F73: return_from_event 0 
// EVENT_VEHICLE_DESPAWN.TXT// Why: Because reasons.{$CLEO}0000:// -1 for any/all cars0F71: create_event_listener 2 at @OnVehicleDespawn vehicle_handle -1 num_vars 0 store_to [email protected] true    wait 600000end:OnVehicleDespawn// [email protected] is the currently despawning vehicle handle0441: [email protected] = car [email protected] model0ADB: [email protected] = car_model [email protected] name0AD3: [email protected] = format "VEHDEL:%s" [email protected]   0662: printstring [email protected] // http://gtag.gtagaming.com/mods/81-sa-scrdebug/0F73: return_from_event 0 
Edited by Girish

Share this post

Link to post
Share on other sites
Jason Statham

Nice. Now scripting will be more easier and fun. :cookie:

Share this post

Link to post
Share on other sites
Joseph Goebbels

wow :O good project


Also, if still end, make GTA III/VC

Edited by The_Pirate

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 1 User Currently Viewing
    0 Members, 0 Anonymous, 1 Guest


Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.