Mod Showroom

 Reply to this postStart new topic

[CLEO|Src] Rockstar North's Car Spawner - SA

Deji
post Sep 23 2011, 01:04 AM
Post #1


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Just a bit of fun, really. I was bored so I thought it would be fun to create it and bridge the gap between R*'s code and what we see. I changed it a bit so it works for PC but it's hardly something to actually use as it is. It also works better with a joypad.

This is a car spawner R*N probably used for debugging. However, it's not made for SA. It's made for a previous GTA You can tell this by looking at the car model names used. Some aren't in SA but are in previous GTA's and there is a different range on them.

However, it could also possibly be for an early version of SA... A crossover between VC and SA, maybe?

Anyway...

SANNY
{$CLEO}
0000:

const
FADE_OUT                = 0
FADE_IN                 = 1
PAD1                    = 0
PAD2                    = 1
CIVMALE                 = 4
RIGHTSHOULDER1          = 6
LEFTSHOULDER1           = 4
CARLOCK_UNLOCKED        = 1
//player                = 0@
//scplayer              = 1@
x_float_m               = 0@
y_float_m               = 1@
z_float_m               = 2@
player_heading_debug    = 3@
debug_car_heading       = 4@
magic_car               = 5@
button_press_flag       = 6@
car_colour              = 7@
car_colour2             = 8@
flag_create_car         = 9@
initial_create_car      = 10@
initial_car_selected    = 11@
counter_create_car      = 12@
CAR_CHEETAH             = #CHEETAH
BIKE_BIKE               = #BIKE
CAR_TAXI                = #TAXI
CAR_CABBIE              = #CABBIE
CAR_POLICE              = #LAPD1
CAR_FIRETRUCK           = #FIRETRUK
CAR_AMBULANCE           = #AMBULAN
CAR_BANSHEE             = #BANSHEE
CAR_INFERNUS            = #INFERNUS
CAR_STINGER             = #TAMPA
PLANE_AIRTRAIN          = #AT400
PLANE_DEADDODO          = #DODO
HELI_POLICE             = #POLMAV
TRAIN_SUBWAY            = #TRAM
CAR_RCBANDIT            = #RCBANDIT
HELI                    = #MAVERICK
end
var
x_float_m:float
y_float_m:float
z_float_m:float
player_heading_debug:float
debug_car_heading:float
magic_car:int
button_press_flag:int
car_colour:int
car_colour2:int
flag_create_car:int
initial_create_car:int
initial_car_selected:int
end

x_float_m = 0.0
y_float_m = 0.0
z_float_m = 0.0
player_heading_debug = 0.0
debug_car_heading = 0.0
magic_car = 0
button_press_flag = 0
car_colour = 0
car_colour2 = 0
flag_create_car = 0
initial_create_car = 0
initial_car_selected = 0
04AF: counter_create_car = CAR_CHEETAH  // @ = constant

{
03A4: name_thread 'mainscr'

0053: player = create_player 0 at 1498.8 -1661.3 12.5
01F5: scplayer = get_player_actor player

016A: do_fade FADE_OUT 0

03CB: load_scene 137.0 -1574.0 11.0

/*
0247: request_model CAR_CHEETAH

WHILE 8248:   not has_model_loaded CAR_CHEETAH

    WAIT 0

END

00A5: test_car = create_car CAR_CHEETAH -1138.406 -661.471 -100.0   // -100.0 (ground z determined automatically)

0249: mark_model_as_no_longer_needed CAR_CHEETAH
*/

0247: request_model #MALE01

WHILE 8248:   not has_model_loaded #MALE01

    WAIT 0

END

009A: test_char = create_char CIVMALE model #MALE01 1500.0 -1660.0 13.0

// 0249: mark_model_as_no_longer_needed #MALE01


//0417: launch_mission (unk)

016A: do_fade FADE_IN 1000
}


while not test_cheat "CARSPAWN"
    wait 0
end

:MainLoop
    
wait 0

    if
        0256:   is_player_playing 0
    then
        if and
            00E1:   is_button_pressed PAD1 RIGHTSHOULDER1
            flag_create_car == 0
            button_press_flag == 0
        then
            00A0: get_char_coordinates $PLAYER_ACTOR x_float_m y_float_m z_float_m
            0172: player_heading_debug = get_char_heading $PLAYER_ACTOR
            if and
                player_heading_debug < 45.0
                player_heading_debug > 0.0
            then
                y_float_m += 5.0
                debug_car_heading = 90.0
            end
            if and
                player_heading_debug < 360.0
                player_heading_debug > 315.0
            then
                y_float_m += 5.0
                debug_car_heading = 90.0
            end
            if and
                player_heading_debug < 135.0
                player_heading_debug > 45.0
            then
                x_float_m -= 5.0
                debug_car_heading = 180.0
            end
            if and
                player_heading_debug < 225.0
                player_heading_debug > 135.0
            then
                y_float_m -= 5.0
                debug_car_heading = 270.0
            end
            if and
                player_heading_debug < 315.0
                player_heading_debug > 225.0
            then
                x_float_m += 5.0
                debug_car_heading = 0.0
            end
            z_float_m += 0.6
            02CE: z_float_m = get_ground_z_for_3d_coord x_float_m y_float_m z_float_m
            0247: request_model counter_create_car
            while 8248:   not has_model_loaded counter_create_car
            
                wait 0
                
                00BC: print_now "LOADCAR" 100 1  //"Loading vehicle, press pad1 leftshoulder1 to cancel"
                
                if
                    00E1:   is_button_pressed PAD1 LEFTSHOULDER1
                then
                    //++ counter_create_car
                    goto @next_carzzz
                end
            
            end
            
            00A5: magic_car = create_car counter_create_car x_float_m y_float_m z_float_m
            0175: set_car_heading magic_car debug_car_heading
            
            020A: lock_car_doors magic_car CARLOCK_UNLOCKED
            
            0249: mark_model_as_no_longer_needed counter_create_car
            01C3: remove_references_to_car magic_car
            
            :next_carzzz
            if
                initial_create_car == 0
            then
                if and
                    counter_create_car == CAR_CHEETAH
                    initial_car_selected == 0
                then
                    counter_create_car = BIKE_BIKE
                    initial_car_selected = 1
                end
                
                if and
                    counter_create_car == BIKE_BIKE
                    initial_car_selected == 0
                then
                    counter_create_car = CAR_TAXI
                    initial_car_selected = 1
                end
                
                if and
                    counter_create_car = CAR_TAXI    
                    initial_car_selected = 0
                then
                    counter_create_car = CAR_CABBIE
                    initial_car_selected = 1
                end
                
                if and
                    counter_create_car = CAR_CABBIE    
                    initial_car_selected = 0
                then
                    counter_create_car = CAR_POLICE
                    initial_car_selected = 1
                end
                
                if and
                    counter_create_car = CAR_POLICE    
                    initial_car_selected = 0
                then
                    counter_create_car = CAR_FIRETRUCK
                    initial_car_selected = 1
                end
                
                if and
                    counter_create_car = CAR_FIRETRUCK
                    initial_car_selected = 0
                then
                    counter_create_car = CAR_AMBULANCE
                    initial_car_selected = 1
                end
                
                if and
                    counter_create_car = CAR_AMBULANCE    
                    initial_car_selected = 0
                then
                    counter_create_car = CAR_BANSHEE
                    initial_car_selected = 1
                end
                
                if and
                    counter_create_car = CAR_BANSHEE    
                    initial_car_selected = 0
                then
                    counter_create_car = CAR_INFERNUS
                    initial_car_selected = 1
                    initial_create_car = 1
                end
                
                if and
                    counter_create_car = CAR_INFERNUS    
                    initial_car_selected = 0
                then
                    counter_create_car = CAR_STINGER
                    initial_car_selected = 1
                    initial_create_car = 1
                end
            else
                counter_create_car += 1
                
                if counter_create_car > 605
                then counter_create_car = 400
                end
                
                if counter_create_car == 417
                then counter_create_car = 418
                end    
                if counter_create_car == 425
                then counter_create_car = 426
                end    
                if counter_create_car == 430
                then counter_create_car = 431
                end
                if counter_create_car == 435
                then counter_create_car = 436
                end        
                if or
                     counter_create_car == 446
                      counter_create_car == 447
                then
                    counter_create_car = 448
                end
                if or
                    counter_create_car == 449
                    counter_create_car == 450
                then
                    counter_create_car = 451
                end

                if and
                    counter_create_car >= 452
                    454 >= counter_create_car
                then
                    counter_create_car = 455
                end
                
                if counter_create_car == 460
                then counter_create_car = 461
                end
                if counter_create_car == 469
                then counter_create_car = 470
                end
                
                if or
                    counter_create_car == 472
                    counter_create_car == 473
                then
                    counter_create_car = 474
                end
                
                if counter_create_car == 476
                then counter_create_car = 477
                end
                
                if and
                    counter_create_car >= 484
                    488 >= counter_create_car
                then
                    counter_create_car = 489
                end
                
                if counter_create_car == 493
                then counter_create_car = 494
                end
                if counter_create_car == 497
                then counter_create_car = 498
                end
                
                if and
                    counter_create_car >= 511
                    513 >= counter_create_car
                then
                    counter_create_car = 514
                end
                
                if or
                    counter_create_car == 519
                    counter_create_car == 520
                then
                    counter_create_car = 521
                end
                if or
                    counter_create_car == 537
                    counter_create_car == 538
                then
                    counter_create_car = 539
                end
                
                if counter_create_car == 548
                then counter_create_car = 549
                end
                if counter_create_car == 553
                then counter_create_car = 554
                end
                if counter_create_car == 563
                then counter_create_car = 564
                end
                
                if or
                    counter_create_car == 569
                    counter_create_car == 570
                then
                    counter_create_car = 571
                end
                
                if counter_create_car == 577
                then counter_create_car = 578
                end
                
                if or
                    counter_create_car == 583
                    counter_create_car == 584
                then
                    counter_create_car = 585
                end
                
                if and
                    counter_create_car >= 590
                    595 >= counter_create_car
                then
                    counter_create_car = 596
                end
            end
            
            flag_create_car = 1
            button_press_flag = 1
        end
        
        if and
            00E1:   is_button_pressed PAD1 LEFTSHOULDER1
            flag_create_car == 1
        then
            if
                8119:   not is_car_dead magic_car
            then
                0209: car_colour2 = generate_random_in_in_range 0 88
                0229: change_car_colour magic_car car_colour car_colour2 // 0 - 88
                car_colour += 1
                if car_colour > 87
                then car_colour = 0
                end
            end
        end

        if and
            80E1:   not is_button_pressed PAD1 RIGHTSHOULDER1
            button_press_flag == 1
        then
            button_press_flag = 0
        end

        if and
            00E1:   is_button_pressed PAD1 RIGHTSHOULDER1
            flag_create_car == 1
            button_press_flag == 0
        then
            if
                0119:   is_car_dead magic_car
            then
                00A6: delete_car magic_car
            else
                if
                    8449:   not is_char_in_car $PLAYER_ACTOR magic_car
                then
                    00A6: delete_car magic_car
                else
                    01C3: mark_car_as_no_longer_needed magic_car
                end
            end
            flag_create_car = 0
            initial_car_selected = 0
            button_press_flag = 1
        end
    end
    
goto @MainLoop

004E: terminate_this_script


--------------------
Go to the top of the page
 
+Quote Post
Huckleberry Pie
post Dec 19 2011, 02:09 PM
Post #2


Ameteur Member

Posts: 49
Joined: 5-August 09



A crossover? I think, since R* most likely used the VC codebase for SA.
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: