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

    1. Red Dead Redemption 2

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

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

      1. Recruitment
    2. Events

    1. GTA Online

      1. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    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

Please be aware that this is not a tutorial request forum! Use the appropriate topic for the effect.
ZAZ

[SA] ~ CLEO Script Tutorial ~

Recommended Posts

minhtroller

hello. so i just made this script and whenever i try to enter the game, it crashes constanly. help please

 

 

{$CLEO .cs}thread 'CODMW2':CODMW2_11wait 0 if    Player.Defined($PLAYER_ACTOR)else_jump @CODMW2_11 Model.Load(#MINIGUN):CODMW2_56wait 0 if    Model.Available(#MINIGUN)else_jump @CODMW2_56:CODMW2_96if or   Actor.DrivingVehicleType($PLAYER_ACTOR, #PATRIOT)   Actor.DrivingVehicleType($PLAYER_ACTOR, #FBITRUCK)else_jump @[email protected] = Actor.CurrentCar($PLAYER_ACTOR)wait 0 if and   Actor.InCar($PLAYER_ACTOR, [email protected])0AB0:   key_pressed 115else_jump @CODMW2_96wait 006A7: put_actor $PLAYER_ACTOR into_turret_on_car [email protected] at_car_offset 0.0 0.0 1.5 position 1 shooting_angle 360.0 0.0 with_weapon 38 :CODMW2_153wait 0 if or02BF:   car [email protected] sunk 00E1:   player 0 pressed_key 15 01F4:   car [email protected] flipped    Actor.Dead($PLAYER_ACTOR)   Car.Wrecked([email protected])else_jump @CODMW2_110465: remove_actor $PLAYER_ACTOR from_turret_mode  wait 0Actor.GiveWeaponAndAmmo($PLAYER_ACTOR, Minigun, 2000)Car.RemoveReferences([email protected])Model.Destroy(#MINIGUN)jump @CODMW2_11 

 

EDIT: i tried this but this aint working either.
{$CLEO .cs}thread 'CODMW2':CODMW2_11wait 0 if    Player.Defined($PLAYER_ACTOR)else_jump @CODMW2_11 Model.Load(#MINIGUN)038B: load_requested_models :CODMW2_56wait 0 if    Model.Available(#MINIGUN)else_jump @CODMW2_56:CODMW2_96if or   Actor.DrivingVehicleType($PLAYER_ACTOR, #PATRIOT)   Actor.DrivingVehicleType($PLAYER_ACTOR, #FBITRUCK)else_jump @[email protected] = Actor.CurrentCar($PLAYER_ACTOR)wait 0 if and   Actor.InCar($PLAYER_ACTOR, [email protected])0AB0:   key_pressed 115else_jump @CODMW2_96wait 0Actor.GiveWeaponAndAmmo($PLAYER_ACTOR, Minigun, 9999)06A7: put_actor $PLAYER_ACTOR into_turret_on_car [email protected] at_car_offset 0.0 0.0 1.5 position 1 shooting_angle 360.0 0.0 with_weapon 38 :CODMW2_153wait 0 if or02BF:   car [email protected] sunk 00E1:   player 0 pressed_key 15 01F4:   car [email protected] flipped    Actor.Dead($PLAYER_ACTOR)   Car.Wrecked([email protected])else_jump @CODMW2_11wait 0fade 0 350wait 4000465: remove_actor $PLAYER_ACTOR from_turret_mode  Actor.GiveWeaponAndAmmo($PLAYER_ACTOR, Minigun, 2000)jump @CODMW2_11
Edited by minhtroller

Share this post


Link to post
Share on other sites
minhtroller

ignore this i accidentally hit new post instead of editing the old one.

Edited by minhtroller

Share this post


Link to post
Share on other sites
BigHomie

Hey guys,

how can i execute some code only if the playe is near a specific ped? Thanks in advance

Share this post


Link to post
Share on other sites
minhtroller

Hey guys,

how can i execute some code only if the playe is near a specific ped? Thanks in advance

Pedtype maybe?

Or check if the player is near a ped model (I don't think that it's possible tho. I haven't been through all of them op codes yet.)

Share this post


Link to post
Share on other sites
Deja vu

is it okay to rename a .cs files from its original compiled script?

for example : car.cs renamed to damn.cs

is it fine or it will crash the game?

#sorryforbadenglish

Share this post


Link to post
Share on other sites
ZAZ

is it okay to rename a .cs files from its original compiled script?

for example : car.cs renamed to damn.cs

is it fine or it will crash the game?

 

#sorryforbadenglish

 

In most cases is it ok,

but it depends to the codes inside, for example in case if the author used 0A92: create_custom_thread to initialize a thread inside the identical script like

or GFXXX.cs

Such scripts a very rarely

 

PimpmyCar mod comes with these files: PmC_DRIVE_final.cs, PmC_Extras.cs, PmC_NEON_final.cs, PmC_driftsmoke.cs, PmC_Sound.cs and PmC_Tuning.cm

 

and these scripts:

PmC_Extras.cs

PmC_NEON_final.cs

PmC_driftsmoke.cs

PmC_Sound.cs

PmC_Tuning.cm

will be initialized by PmC_DRIVE_final.cs

so these script can't be renamed

also, never rename a *.cm file

Share this post


Link to post
Share on other sites
Deja vu

uh and one of my .cs file is refused to open, what happened? other .cs's works fine with Sany Builder 3

i want to modify the codes inside but it can't be opened,

Sany Builder opens the .txt file without a problem, but the thing is, this script (.cs) file, there is no .txt file (uncompiled), so i can't edit it ..

so i try to open the .cs file using Notepad and modify the codes, but it crash the game.

is there any other way to edit the codes on .cs file ?

Edited by Deja vu

Share this post


Link to post
Share on other sites
Deja vu

uh and one of my .cs file is refused to open, what happened? other .cs's works fine with Sany Builder 3

i want to modify the codes inside but it can't be opened,

Sany Builder opens the .txt file without a problem, but the thing is, this script (.cs) file, there is no .txt file (uncompiled), so i can't edit it ..

so i try to open the .cs file using Notepad and modify the codes, but it crash the game.

is there any other way to edit the codes on .cs file ?

 

WELL nevermind

Updated Sanny Builder 3 to latest version

it fixed the problem ...

Edited by Deja vu

Share this post


Link to post
Share on other sites
deltaCJ

How can I make an elevator?

 

Out of objects :p

Share this post


Link to post
Share on other sites
deltaCJ

What about status bars?

 

I know how to do health and stuff,

but what about Distance?

 

And time?

 

And races???

Share this post


Link to post
Share on other sites
ZAZ

What about status bars?

 

I know how to do health and stuff,

but what about Distance?

 

And time?

 

And races???

 

Status bars, there are comfortable codes, 03C4: or 04F7:, but requires to insert global vars, not good for cleo, same for the timer 03C3:

 

It can be done with text_draw codes, a bar with draw_box or draw_texture, but it needs a lot calculations

Look for timer example in the chapter "math coding" for the lesson "Time check for milliseconds in real time" and "Time check for game hours" and here

 

Example that shows car health by 038E: draw_box

{$CLEO .cs}:Draw_Box_Status_Bar03A4: name_thread 'DBS_BAR' :BAR_10001: wait  0 msif0256:   player $PLAYER_CHAR definedjf @BAR_1if00DF:   actor $PLAYER_ACTOR driving jf @BAR_103C0: [email protected] = actor $PLAYER_ACTOR car0007: [email protected] =  625.5  // floating-point values [email protected] = 0.0:BAR_3wait 0if  and00DF:   actor $PLAYER_ACTOR driving8119:   not car [email protected] wrecked  jf @BAR_10227: [email protected] = car [email protected] health008F: [email protected] = integer [email protected] [email protected] *= 0.064if0025:   [email protected] > [email protected] // (float)jf @BAR_70087: [email protected] = [email protected]@ /= 2000.00063: [email protected] -= [email protected] // (float)jump @BAR_9:BAR_7if0025:   [email protected] > [email protected] // (float)jf @BAR_90087: [email protected] = [email protected]@ /= 2000.0005B: [email protected] += [email protected] // (float):BAR_90087: [email protected] = [email protected]  // floating-point values only0087: [email protected] = [email protected]  // floating-point values only0013: [email protected] *=  1.4  // floating-point values0013: [email protected] *=  0.7  // floating-point values0063: [email protected] -= [email protected]  // floating-point values03F0: enable_text_draw 1  038E: draw_box_position 580.0 430.0 size 94.0 14.0 RGBA 0 0 0 255  038E: draw_box_position 580.0 430.0 size 88.0 8.0 RGBA 170 170 170 255038E: draw_box_position [email protected] 430.0 size [email protected] 8.0 RGBA 255 0 0 2550087: [email protected] = [email protected]: [email protected] = [email protected] @BAR_3

 

Example that shows Player health by draw_texture

{$CLEO .cs}:TXD_Bar_103A4: name_thread 'STSB':TXD_Bar_4wait 0if0256:   player $PLAYER_CHAR definedjf @TXD_Bar_40390: load_txd_dictionary 'LD_DUAL' 038F: request_texture "Health" as  1  // Load dictionary with 0390 first038F: request_texture "black" as  2  // Load dictionary with 0390 firstwait 500:TXD_Bar_16wait 0if0256:   player $PLAYER_CHAR definedjf @TXD_Bar_320226: [email protected] = actor $PLAYER_ACTOR health0093: [email protected] = integer [email protected] to_float0087: [email protected] = [email protected]  // floating-point values only0013: [email protected] *=  1.5  // floating-point values0013: [email protected] *=  0.8  // floating-point values0007: [email protected] =  450.0  // floating-point values0063: [email protected] -= [email protected]  // floating-point values03F0: text_draw_toggle  1038D: draw_texture 2 position 300.0  21.0 size 304.0  14.0 RGBA 180  180  180  255 038D: draw_texture 1 position [email protected]  20.0 size [email protected]  10.0 RGBA 180  180  180  255 jump @TXD_Bar_16:TXD_Bar_3203F0: toggle_text_draw 0jump @TXD_Bar_4

Distance, there's a useful code:

0509: [email protected] = distance_between_XY [email protected] [email protected] and_XY [email protected] [email protected]

I used it inside the NFS_OUTRUN.cm that comes with the N-RACES mod to display a bar that shows the distance beween actor car and player car

 

Races? needs to explain romans

Edited by ZAZ

Share this post


Link to post
Share on other sites
deltaCJ

Races, like how can I make the position thing?

Like so when a actor passes me im in 2nd place or something like that.

 

 

BTW object.throw doesn't work for me unless I jump...

Share this post


Link to post
Share on other sites
ZAZ

Races, like how can I make the position thing?

Like so when a actor passes me im in 2nd place or something like that.

You have to use arrays

so it needs to check which checkpoint was passed by each driver as well as the player

additional it needs to calculate the distances of the drivers to next checkpoint as well the distance of playeractor to next checkpoint

then you can compare the distances by considering the passed checkpoints to deside which actor is first, second, third

Edited by ZAZ

Share this post


Link to post
Share on other sites
deltaCJ

Okay, look other thing:

0605: actor [email protected] perform_animation "ENDCHAT_02" IFP "PED" framedelta 4.0 loop 0 lockX 0 lockY 0 lockF 0 time -1 05A9: s$ACTOR_SPEECH_GXT_REFERENCE = 'CRA1_06' // s$ 04AE: $ACTOR_SPEECH_WAV_FILE = 10626 // = constant create_thread @AUDIOL [email protected] 1 1 1 0 

This crashes for me... I put my own GXT and everything but it crashes :(

Share this post


Link to post
Share on other sites
ZAZ

I need to see the context. Post your whole stripped main, but please post it in the coding section, because this tut here belongs to Cleo

Share this post


Link to post
Share on other sites
Light Syde Riandy

Anyone knows the code to setup gang behavior?

Share this post


Link to post
Share on other sites
ZAZ

script below makes ballas respectfull to player_char and triads agressiv to player_char

 

{$CLEO .cs}thread 'pedstat'wait 20000746: set_acquaintance 1 of_actors_pedtype 7 to_actors_pedtype 00746: set_acquaintance 4 of_actors_pedtype 13 to_actors_pedtype 00A93: end_custom_thread
acquaintance 1 = respect, run away when attack

acquaintance 2 = friendly, but agressiv when attack

acquaintance 3 = agressiv

acquaintance 4 = very agressiv

 

look for pedtype in Sannybuilder Help > SCM Documentation > GTA SA > PedTypes

Share this post


Link to post
Share on other sites
Light Syde Riandy

And the code for making Rifa attack me after I pass "Pier 69" and making Da Nang Boys attack me after I pass "Mountain Cloud Boys"?


This is optional but, is there a code to make a random vehicle unflip when it is accidentally flipped over?

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
ZAZ

And the code for making Rifa attack me

same code but with other pedtypes

 

 

 

after I pass "Pier 69"

make a check for the Pier 69 mission passed global var, look in main.scm

 

 

 

and making Da Nang Boys attack me after I pass "Mountain Cloud Boys"?

please use your brain or post in request topic

 

 

 

This is optional but, is there a code to make a random vehicle unflip when it is accidentally flipped over?

there're codes to get controle of a random car but it's difficult and can be unstable and there're codes to reset a car when fliped, cheat_menue script resets y-angle by opcode 0731:, a very old method is to get the car position and just put the car there by opcode 00AB:, another method is opcode 07DB:

but in which case is a random car flipped? i assume you mean a race, so it's a mission car and then it's recommanded to implement the solution inside the race mission script

Share this post


Link to post
Share on other sites
Light Syde Riandy

but in which case is a random car flipped?

In a DYOM race mission.

Share this post


Link to post
Share on other sites
deltaCJ

I'm if it's for dyom I don't think it will work.

Share this post


Link to post
Share on other sites
ZAZ

Basicly it's possible, but there're problems like the engine finds any car but not that one which we want to controle
test the script below, it let any random car do a jump flip, also those of the race mission

{$CLEO .cs}:Random_Car_Flipthread 'RANDCAR'wait 5000while truewait 0    if    0256:   player $PLAYER_CHAR defined     then        077E: get_active_interior_to [email protected]        if            [email protected] == 0        then             if                00DF:   actor $PLAYER_ACTOR driving             then                03C0: [email protected] = actor $PLAYER_ACTOR car                [email protected] = 1             end                                                04C4: create_coordinate [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR offset  0.0  4.0  0.0            if                                                                                                                   0AE2: [email protected] = random_vehicle_near_point [email protected] [email protected] [email protected] in_radius 20.0 find_next 0 pass_wrecked 0 //IF and SET             then                                                                                                                 if                                                                                                                   8039:   NOT   [email protected] ==  -1                                                                                          then                    if or                        [email protected] == 0                        803B: not  [email protected] == [email protected]  // (int)                    then                                            if                            8119:   not car [email protected] wrecked                         then                            07DB: set_car [email protected] rotation_velocity_XYZ 12.0 0.0 0.0 through_center_of_mass                        end                    end                                        wait 2000                    01C3: remove_references_to_car [email protected]                                                                                    [email protected] = -1                    wait 2000                                                        end            end        end    endend 

Share this post


Link to post
Share on other sites
Light Syde Riandy

Will try the code later.

 

In the meantime, what about the script that disables the spawning of random parked cars during play mission mode in DYOM?

 

And again, optional.

Share this post


Link to post
Share on other sites
Light Syde Riandy

The unflip code only makes every cars bouncing like crazy, so I guess this is most likely impossible.

Share this post


Link to post
Share on other sites
Light Syde Riandy

Hello, I just made a script that locks player's weapon skill at "Gangster". It worked like charms. But the problem is, after I load one of my saves, I keep getting weapon skill notification until I go to DYOM mode. How do I stop it?

 

Here's the code:

 

{$CLEO .cs}
thread 'GANGSTER'

:MAIN_PART
wait 0
if
Player.Defined($PLAYER_CHAR)
jf @MAIN_PART
062A: change_float_stat 69 to 400.0
062A: change_float_stat 70 to 400.0
062A: change_float_stat 71 to 400.0
062A: change_float_stat 72 to 400.0
062A: change_float_stat 73 to 400.0
062A: change_float_stat 74 to 400.0
062A: change_float_stat 75 to 400.0
062A: change_float_stat 76 to 400.0
062A: change_float_stat 77 to 400.0
062A: change_float_stat 78 to 400.0
062A: change_float_stat 79 to 0.0
wait 100
jump @MAIN_PART

 

Edited by Light Syde Riandy

Share this post


Link to post
Share on other sites
ZAZ

it's because your stat change codes are running in an infinity loop

Share this post


Link to post
Share on other sites
Light Syde Riandy

So which part of the code should I change?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


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

×
×
  • Create New...

Important Information

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