Jump to content

Scripting Tutorials


Recommended Posts

Ok, i thought i'd make this to make it Easyer for people to find what they need scripting wise, i will add a Few San Andreas Opcodes for you to Chew on for now smile.gif

 

$2 is Equal to $PLAYER_CHAR

 

Lets Make the Player Appear 'Drunk' Like i was when i posted tounge.gif

 

052C: set_player $PLAYER_CHAR drunk_visuals  100

 

 

CellPhone Animations

 

0247: request_model #CELLPHONE;Get the Cellphone0729: unknown_action_sequence $PLAYER_ACTOR 1;Start Mobile Call0729: unknown_action_sequence $PLAYER_ACTOR 0;End Mobile Call0249: release_model #CELLPHONE

 

As you can See, the 0729: lines are the Same, apart from the 1 and the 0, 1 is to turn it on and 0 is to turn it off smile.gif Try them

 

Now, How about giving the Player a Jetpack.

 

07A7: put_jetpack_on_actor $PLAYER_ACTOR

 

 

Keep your Weapons etc after you are Killed/Arrested:

 

08DE: keep_stuff_after_busted 0 (0=on/1=off)08DD: keep_stuff_after_wasted 0 (0=on/1=off)

 

 

Ok, Let's Move on.

 

Now we will Create a Marker, and make it Detect the Player, if the Player is In the Area, he will get $10,000 every few seconds.

 

Add

 

 

02A7: $439 = create_icon_marker_and_sphere $441 at X Y Z

 

Replace X Y and Z with your Own Co ords (this is where the Marker will be)

to the Bottom of Main, Then add

 

004F: create_thread ££CASH_1 

 

underneath that.

 

Then add this to the Bottom of the Script.

 

 

:CASH_10001: wait  250 ms00D6: if  000ED:   actor $3 0 ()near_point_on_foot X Y radius  4.0  4.0004D: jump_if_false ££CASH_10109: player $2 money +=  10000   0001: wait 5000 ms0002: jump ££CASH_1

 

 

Replace X and Y with your X and Y Co ordinates from the Game.

 

Now Let Me Explain a Little colgate.gif.

 

The 0001: wait * ms is How long to Wait Before (re)Performing the Action.

 

00ED: actor $3 0 ()near_point_on_foot X Y radius 4.0 4.0 - This Will Check to See if our Player is in the Created Marker, use the Same X and Y Co Ords as your Marker Further Up.

 

0109: player $2 money += 10000 - This will Give your Player $10,000, Replace 10000 with what ever amount you want your Player to Recieve.

 

0001: wait 5000 ms - This will make the Game Wait 5 seconds before giving another $10k. put as 0 for Infinite Loop.

 

I hope this Helped a Few People out. colgate.gif

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/
Share on other sites

  • 2 weeks later...

Sorry fora Late Reply, I'm having internet Problems atm, But anyway...

 

@ evilrex : 052C: set_player $PLAYER_CHAR drunk_visuals 100

I Normally put this Under Main... colgate.gif

 

@ plunk89 : Detect if the Player is in the Area, if he is, then Make him Drunk (add Drunk line with 100, wait 60000ms (i think), then set the Drunk visuals to 0. Should work smile.gif

 

 

 

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-4260389
Share on other sites

matyassv12

hello, i'm trying to install a steed mod for SA i need help with this :

 

 

 

004F: create_thread ££BIKETH

 

:BIKETH

0001: wait 0 ms

03A4: name_thread "STEED"

 

:BIKE1

0001: wait 127 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££BIKE1

00D6: if 0

03EE: player $PLAYER_CHAR controllable

004D: jump_if_false ££BIKE1

00D6: if 0

047A: $PLAYER_ACTOR;; 047A: actor $PLAYER_ACTOR driving_a_motorbike

004D: jump_if_false ££BIKE4

03C0: @0 = actor $PLAYER_ACTOR car

 

:BIKE2

0226: @5 = actor $PLAYER_ACTOR health

0227: @6 = car @0 health

0001: wait 10 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££BIKE1

00D6: if 0

82BF: NOT car @0 sunk

004D: jump_if_false ££BIKE3

00D6: if 0

80E1: NOT key_pressed 0 15

004D: jump_if_false ££BIKE3

;00D6: if 0

;8038: NOT $BIKEOFF == 1

;004D: jump_if_false ££BIKE3

00D6: if 0

80DF: NOT actor $PLAYER_ACTOR driving

004D: jump_if_false ££BIKE2

018C: play_sound 1058 at 0.0 0.0 0.0

036A: put_actor $PLAYER_ACTOR in_car @0

0223: set_actor $PLAYER_ACTOR health_to @5

0224: set_car @0 health_to @6

0002: jump ££BIKE2

 

:BIKE3

0001: wait 127 ms

00D6: if 0

0256: player $PLAYER_CHAR defined

004D: jump_if_false ££BIKE1

00D6: if 0

80DF: NOT actor $PLAYER_ACTOR driving

004D: jump_if_false ££BIKE3

01C3: remove_references_to_car @0;; Like turning a car into any random car

0002: jump ££BIKE1

 

:BIKE4

00D6: if 0

80DF: NOT actor $PLAYER_ACTOR driving

004D: jump_if_false ££BIKE1

00D6: if 1

00E1: key_pressed 0 6

00E1: key_pressed 0 8

004D: jump_if_false ££BIKE1

077E: $ACTIVE_INTERIOR = active_interior

00D6: if 0

0038: $ACTIVE_INTERIOR == 0 ;; integer values

004D: jump_if_false ££BIKE1

0172: @4 = actor $PLAYER_ACTOR z_angle

04C4: create_coordinate @1 @2 @3 from_actor $PLAYER_ACTOR offset 0.0 -1.0 -1.0

0247: request_model #NRG500

038B: load_requested_models

 

:BIKELAST

0001: wait 0 ms

00D6: if 0

0248: model #NRG500 available

004D: jump_if_false ££BIKELAST

00A5: @0 = create_car #NRG500 at @1 @2 @3

0175: set_car @0 z_angle_to @4

0249: release_model #NRG500

036A: put_actor $PLAYER_ACTOR in_car @0

04BA: set_car @0 speed_instantly 20.0

01C3: remove_references_to_car @0;; Like turning a car into any random car

0002: jump ££BIKE2

 

 

 

What do i have to do with that... do i have to just paste it at the end of main.scm or what please help

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-4275689
Share on other sites

  • 1 month later...
  • 4 weeks later...
  • 6 months later...

I have major problems with this mod, i can get the red sphere to spwan outside the johnson house, but no cash marker, and when i stand in the marker, nothing happens.

Can you tell me where to put these lines? I have the spere amrker code just before the mission 1 data, under the police bribe codes, this works, but the rest of the code is at the bottom of the file, where the RC shop data is, and it doesnt work, ive tried to put this data next to the bribe data, (further up the file, but i just get compling errors) can any tell me exactley where to put this code? Also there are 3 bits of code, i no im asking, but can i have 3 locations??

 

Any help on this would be greatly appriciated!!!

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-1057456315
Share on other sites

  • 2 weeks later...

OK, ive tried again,

 

ive got the full code at the bottom of main, just above mission 0 and i gat nothing, ive had this code working before, but i cant remember where i put it!

 

come on, give me a clue?

 

can you give me maybe a few code boxes with the information, or a screenshot or something?

 

 

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-1057507085
Share on other sites

OK, ive tried again,

 

ive got the full code at the bottom of main, just above mission 0 and i gat nothing, ive had this code working before, but i cant remember where i put it!

come on, give me a clue?

can you give me maybe a few code boxes with the information, or a screenshot or something?

Here is an Example of a Totally Stripped SCM With the Cash Marker Function Added....

 

 

DEFINE VERSION SA 0.330002: jump ££Second_SegmentDEFINE MEMORY  100  ; Equals Mission Builder type global variable range $2 to $24:Second_Segment0002: jump ££Third_SegmentDEFINE OBJECTS  1DEFINE OBJECT WWW.FREEWEBS.COM/L3MMY/                ; This is an unused object. You can put anything here.:Third_Segment0002: jump ££Fourth_SegmentDEFINE MISSIONS  0:Fourth_Segment0002: jump ££Fifth_SegmentDEFINE EXTERNAL_SCRIPTS  0:Fifth_Segment0002: jump ££Sixth_SegmentDEFINE UNKNOWN_FIFTH_SEGMENTDEFINE UNKNOWN1  0:Sixth_Segment0002: jump ££MAIN_1DEFINE UNKNOWN_SIXTH_SEGMENTDEFINE UNKNOWN3  0;-------------MAIN---------------:MAIN_103A4: name_thread 'MAIN'016A: fade  0 ()  0 ms042C: set_total_missions_to  0030D: set_total_mission_points_to  001F0: set_max_wanted_level_to  60111: set_wasted_busted_check_to  0 (disabled)00C0: set_current_time  10  00005: $7 =  -2787.0 ;; floating-point values0005: $6 =  -1113.7 ;; floating-point values0005: $5 =  60.0 ;; floating-point values04E4: unknown_refresh_game_renderer_at $7 $603CB: set_camera $7 $6 $5062A: change_stat  165 (energy) to  999.0 ; float062A: change_stat  23 (muscle) to  999.0 ; float062A: change_stat  21 (fat) to  0.0 ; float062A: change_stat  163 (health upgrade) to  999.0 ; float062A: change_stat  160 (driving skill) to  999.0 ; float062A: change_stat  229 (bike skill) to  999.0 ; float062A: change_stat  223 (pilot skill) to  999.0 ; float062A: change_stat  230 (cycling skill) to  999.0 ; float0629: change_stat  181 (islands unlocked) to  4 ; integer see statdisp.dat0629: change_stat  68 () to  0 ; integer see statdisp.dat0053: $2 = create_player #NULL at $7 $6 $507AF: $11 = player $2 group01F5: $3 = create_emulated_actor_from_player $20373: set_camera_directly_behind_player0173: set_actor $3 z_angle_to  262.001B6: set_weather  1087B: set_player $2 clothes "BBALLJACKRSTAR" "BBJACK"  0 087B: set_player $2 clothes "JEANSDENIM" "JEANS"  2 087B: set_player $2 clothes "SNEAKERBINCBLK" "SNEAKER"  3 087B: set_player $2 clothes "PLAYER_FACE" "HEAD"  1 070D: $2 04BB: select_interior  0 ;; select render area01B4: set_player $2 frozen_state  1 (unfrozen)01B7: release_weather016C: restart_if_wasted at $7 $6 $5 angle  0.0 unknown  0 0247: request_model #HYDRA02A7: $439 = create_icon_marker_and_sphere $441 at 0.0 1.0 2.0;;Replace 0.0 1.0 2.0 with your x, y, z004F: create_thread ££CASH_1:MAIN_390001: wait  0 ms00D6: if  00248:   model #HYDRA available004D: jump_if_false ££MAIN_3900A5: $4 = create_car #HYDRA at $7 $6 $5036A: put_actor $3 in_car $4016A: fade  1 (back)  1000 ms0001: wait  100 ms03E6: remove_text_box:MAIN_480001: wait  2500 ms0002: jump ££MAIN_48:CASH_10001: wait  250 ms;How Long To wait each time (To Prevent infinate loop) 1000 = 1 Second.00D6: if  000ED:   actor $3 0 ()near_point_on_foot X-Coord Y-Coord radius  4.0  4.0004D: jump_if_false ££CASH_10109: player $2 money +=  10000  ;The Player will Recieve $10,0000001: wait 5000 ms0002: jump ££CASH_1

 

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-1057511697
Share on other sites

You can use Barton's Mission Builder or Sanny Builder.

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-1057526069
Share on other sites

It's Barton's one. But if you don't know where to put the code, search by the Tut section.

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-1057529546
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Hi...

 

I want to make a Application

that application can stop a speed of cars or bikes or ...

for exaple you like to driving a car with 50 Km speed (in GTA san andreas) you Enable that Application and after that you can drive a car or ... in same speed.

 

But i don't know how can i making that Application!

1-Help Me for making that application or if you made that please tell me or upload that and after that show the Download Link.

2-if we have a Trainer and with that Trainer ; you can drive a same speed of cars please tell me..

 

>>>>>>>>Sorry I Can not write very good English <<<<<<<<

 

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-1057689363
Share on other sites

  • 3 months later...
  • 1 month later...
  • 3 months later...
oGeesKeeMasK

A'ight, I've nvr really been good at this, the one mission bldr that's left will just about allw ths 2 hppn. I wnt to replace a line in the SAMB,

"EVENT_DRAGGED_OUT_CAR" to something alng the lines of

"EVENT_REMOVED_FROM_CAR" or something in the form of a jack mve by the OGF in San Andreas instead of just "Dragging" the guy out and beating him up, I wnt them to drag him out and take the car. sarcasm.gifcookie.gifmoto_whistle.gif How would I word it?

 

Link to comment
https://gtaforums.com/topic/277522-scripting-tutorials/#findComment-1058842072
Share on other sites

  • 5 years later...

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
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

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