Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (85,928 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. 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

    2. Red Dead Redemption

    3. 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. Forum Support

    2. Site Suggestions

Sign in to follow this  
caeser10

Object in radius

Recommended Posts

caeser10

Well, hi all, I'm a total newbie in CLEO coding and I've spent 4 hours on my first piece of code. The point is I've found multiple syntax rules and opcodes all over the internet and I dunno how to write correctly. I want to show off a text draw above an object (vending machine ID 1209) when the player gets close by (radius of 200 meters). I'm looking for the opcode that will allow to identify an object with its ID and convert it to a float ([email protected]) but I'm exhausted and my brain is smoking. Here is the beginning (sorry for the poor quality):

 

{$CLEO .cs}

//-------------MAIN---------------
0000: NOP

:MNBG_1
wait 500
Actor.StorePos($PLAYER_ACTOR, [email protected], [email protected], [email protected])
set_visibility_of_closest_object_of_type [email protected] [email protected] [email protected] radius 200.0 model $1209 visibility 1
jump @MNBG_1

 

 

 

Thanks for helping!!!!

Edited by caeser10

Share this post


Link to post
Share on other sites
Jack
Read CLEO scrypt tutorial first and then try with this:

{$CLEO}
0000: OID

WHILE 8256: not player $PLAYER_CHAR defined
wait 250
END

WHILE TRUE
wait 0
00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]
IF
0AE3: [email protected] = random_object_near_point [email protected] [email protected] [email protected] in_radius 200.0 find_next 0 // are there any object within players radius of 200.0?
THEN
REPEAT
IF
09CC: object [email protected] model_is 1209 // is the object ID 1209
THEN
0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset 0.0 0.0 5.0 // 5.0 is a Z coord position (above object)
text draw should be here - I'm not sure which opcode - I don't work with them much
END
UNTIL 8AE3: not [email protected] = random_object_near_point [email protected] [email protected] [email protected] in_radius 200.0 find_next 1 //IF and SET
END
END

Good luck.

Share this post


Link to post
Share on other sites
caeser10

Thank you so much!! it's gonna be very useful. As you are not comfortable with text draw, I ask someone else some help with this :

{$CLEO}0000: OID WHILE 8256:   not player $PLAYER_CHAR defined    wait 250END WHILE TRUE    wait 0    00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]    03F0: enable_text_draw 1    IF        0AE3: [email protected] = random_object_near_point [email protected] [email protected] [email protected] in_radius 200.0 find_next 0 // are there any object within players radius of 200.0?    THEN        REPEAT            IF                09CC:   object [email protected] model_is 1209  // is the object ID 1209               THEN            0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset 0.0 0.0 5.0  // 5.0 is a Z coord position (above object)        0342: set_text_draw_centered 1        081C: draw_text_outline 1 RGBA 0 0 0 175        0340: set_text_draw_RGBA 255 255 255 175        033F: set_text_draw_letter_size 0.3 1.1        033E: set_draw_text_position [email protected] [email protected] GXT 'Go there'            END        UNTIL 8AE3:   not   [email protected] = random_object_near_point [email protected] [email protected] [email protected] in_radius 200.0 find_next 1 //IF and SET    ENDEND

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
Sign in to follow this  

×

Important Information

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