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
    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

Hijong parl

(GTA SA) Paramedic side mission with other vehicles

Recommended Posts

Hijong parl

I like flying helicopters in GTA but disappointed that threre's only 1 endless side mission for helicopters called Brown Thunder, which is too easy and boring since Hunter is too powerful and criminals dont attack me most of the time. So I want to play taxi driver or Paramedic missions with helicopter, as these missions are about carrying a person to the point safely within the time limits which would be quite challenging in helicopter.

 

I have searched for mods that do it, but unfortunately there were no mods that allow to do side missions with other vehicles except the one for vigilante. So I decided to solve it myself.

 

I got that it's possible to change the vehicles type to police cars, taxi, or ambulance by modifying the main.sc file, but I couldn't find any tutorials for it especially for GTA SA, So I need a help to figure it out.

 

For example, I want to make maverick helicopters to do taxi driver mission.

 

I opened main.sc located in data folder of GTA SA. I don't know anything about GTA modding and its codes, but I'm suspecting that this part is about activating paramedic mission :

 

IF counter_create_car = 97

AND initial_car_selected = 0

counter_create_car = 106 //CAR_AMBULANCE

initial_car_selected = 1

ENDIF

 

but it must be wrong, I absolutely don't know anything about it. I tried to change counter_create_car value to 487 // HELI_MAVERICK and it didn't work as expected.

 

How to make the other vehicles to do Paramedic side mission by modifying main.scm ? Or, are there any other solutions for it ?

Share this post


Link to post
Share on other sites
OrionSR

The main problem is, main.sc looks like a simple test script that hasn't been compiled. It is not the same as main.scm. Look for main.scm in the data\scripts folder. Decompile to a text file with Sanny Builder.  Searching for Paramedic will bring you to the AMBULAN script, and R3, the script that triggers it.

 

This is an awesome idea for a mission. Seldom to I find an idea for a mod that I'd actually like to play, so good luck. However, if you choose to edit main.scm it will be much more difficult to share, and for players to use. Editing a modified main.scm would be a good place to start, but if you get it working at all, then consider turning the mission script into a custom cleo mission. 

 

Please consider including the Raindance as a one of the vehicles that can be used in this mission.

Share this post


Link to post
Share on other sites
Jack
1 hour ago, OrionSR said:

The main problem is, main.sc looks like a simple test script that hasn't been compiled. It is not the same as main.scm. Look for main.scm in the data\scripts folder. Decompile to a text file with Sanny Builder.  Searching for Paramedic will bring you to the AMBULAN script, and R3, the script that triggers it.

 

This is an awesome idea for a mission. Seldom to I find an idea for a mod that I'd actually like to play, so good luck. However, if you choose to edit main.scm it will be much more difficult to share, and for players to use. Editing a modified main.scm would be a good place to start, but if you get it working at all, then consider turning the mission script into a custom cleo mission. 

 

Please consider including the Raindance as a one of the vehicles that can be used in this mission.

 

Well there's a way to play taxi missions at the vehicle of your choosing without touching the main.scm but the trouble is that we would have to modify the opcode:

0602:   actor $PLAYER_ACTOR driving_taxi


which will effect all mods that are using this command.
So basicly it's not a solution - just a thought, an idea which we could use for our own gameplay only.

 

And of course there's also a method to edit the opcode parameters used inside the main.scm.
Dmitry once showed a direct approach (which will work even with modified main.scm) but do to a latest forum update the link he provided is broken.
I can't remember the topic unfortunately.

 

A lot of interesting stuff related with this subject could be found here:
CTheScripts.cpp

 

Strictly speaking these two:

CTheScripts::ScriptSpace
CTheScripts::MissionBlock

I saw some people using that method (which is nothing new of course) but I've personaly never used it to make something good enough (I was just playing around with it).
It's very intriguing.

Share this post


Link to post
Share on other sites
Hijong parl
6 hours ago, OrionSR said:

The main problem is, main.sc looks like a simple test script that hasn't been compiled. It is not the same as main.scm. Look for main.scm in the data\scripts folder. Decompile to a text file with Sanny Builder.  Searching for Paramedic will bring you to the AMBULAN script, and R3, the script that triggers it.

 

This is an awesome idea for a mission. Seldom to I find an idea for a mod that I'd actually like to play, so good luck. However, if you choose to edit main.scm it will be much more difficult to share, and for players to use. Editing a modified main.scm would be a good place to start, but if you get it working at all, then consider turning the mission script into a custom cleo mission. 

 

Please consider including the Raindance as a one of the vehicles that can be used in this mission.

 

So I was wasting time on the wrong file... Unfortunately I can't modify main.scm file, There's a strange words instead of proper codes like these:

 

TLKBGANGS  @  ? 配?? b ? ?M *?? 9 M *?? ?b M W?g b ? ? ? ?b M 6?Gb ?b ? 配?? b ? ?M 孰? 9 M 孰 配 뜁? ?b M 먼h b h 

? ? 9 I M 왔? ?f ?b M 왔? ?b ? ? M N?? ?/E*??T踐A :?b ?/E*??T踐As }?&A? ?b M ?r b ?E퀟?詐횫 粥bb ?E퀟?詐횫sb ??f
f ?f ?f f I ? ?b M Υ?b Gb ? G ?
ON_LOOKERS? ?? BURHOUS ? ? ? /E  벮  ?m ?  RYD1_39 ?? ?b M s?? ?b , M %??b ?뽚0E?붍憺퐸1E퐬?I.틻???0EX9뮽쑔풞???? ?Ep?붍e*헊?/EK??돈헊???/E-벮뺝헊???C b 3 ? 9 3 M ?? ? /E @뮽 @D   A   A   A ? \/E?벮(혽슇?슇?  @@ M ?? dm ? j? ? kM 罔 眺? ?? & _췯/E?뮽C<D            `mu/E?뮽?D[Z?? ???/E(<뮽D?? \/E?벮  잸? ?/E?뮽Ds     ?     훖 ?+ p-E?빫    1E 젍?   B?츐/E=
뮽3D  ??츐/E=
뮽3D?? ?b M 境?b Gk? H?kM а 한 " ? " M 凌k? " ? " ? " u " ?u " n " ?u " ? ? ? ? ! ?   /DM #??n " ?/E?벮   A Q " fu " ?u " ?u " ?u "
 /
 " Ρ? INT_HOUSE?GANGS? ? INT_HOUSE?GANGSM 빿 죗G>G]? H?>H?]M m? 뚍? >?0Ed"뮽?Dc `c Fc ??0Ed"뮽?D  @j c c ( ? c ?0Ed"뮽?Dsc   퀯?c ??c c

 

Considering there's already a mod that allows to do vigilante missions with any vehicles, taxi driver and paramedic missions must be possible too, but it seems I can't accomplish it.

 

Share this post


Link to post
Share on other sites
OrionSR
6 hours ago, OrionSR said:

Decompile to a text file with Sanny Builder.

Yeah, the binary code is really hard to work with. Sanny Builder is the tool I use to decompile and recompile main.scm files, and also edit and compile cleo scripts.

Share this post


Link to post
Share on other sites
Hijong parl
Posted (edited)
5 minutes ago, OrionSR said:

Yeah, the binary code is really hard to work with. Sanny Builder is the tool I use to decompile and recompile main.scm files, and also edit and compile cleo scripts.

Thanks, I didn't know I had to use that tool to modify main.scm.

 

I found a tutorial about doing vigilante mission with any vehicles in GTA VC. It won't be useful for SA since the code must be different, But I can at least try. just hope the vigilante mission code is similar to taxi driver and paramedic as well.

 

http://viper.shadowflareindustries.com/files/vc/vc_vigilanteanywhere_rm.html

Edited by Hijong parl

Share this post


Link to post
Share on other sites
Hijong parl

Unfortunately SA has the entirely different codes, so This tutorial is not useful.

Share this post


Link to post
Share on other sites
OrionSR

Oh wow. That is an old reference.
 

Barton's builder v1.3

Barton's builder used a different format than Sanny, but the codes are basically the same. If you decompile main.scm from VC with the Write opcodes option enabled you can probably tease out the differences in how the two builders manage the same data. Sanny's format is used for almost all references for San Andreas.

BTW, Raindance doesn't look like a good option. References report it only has seats for 1 passenger.

A VC reference for Vigilante wasn't going to help much anyway with SA and Paramedic.  Start working through the script and identify references to #AMBULAN in the R3 script and AMBULAN mission, replace with #MAVERICK and see what happens.

Share this post


Link to post
Share on other sites
Hijong parl
1 hour ago, OrionSR said:

Oh wow. That is an old reference.
 

Barton's builder v1.3

Barton's builder used a different format than Sanny, but the codes are basically the same. If you decompile main.scm from VC with the Write opcodes option enabled you can probably tease out the differences in how the two builders manage the same data. Sanny's format is used for almost all references for San Andreas.

BTW, Raindance doesn't look like a good option. References report it only has seats for 1 passenger.

A VC reference for Vigilante wasn't going to help much anyway with SA and Paramedic.  Start working through the script and identify references to #AMBULAN in the R3 script and AMBULAN mission, replace with #MAVERICK and see what happens.

 

I tried but I can't compile the modified Main.scm, sanny builder says "Incorrect number of the conditions".

Share this post


Link to post
Share on other sites
OrionSR

Oh, yeah. That always happens. That's from a buggy dead code segment. Delete those lines or comment them out - it won't hurt anything as they never run. Do a search if you need more specific information - lots of people have run into this problem.

Share this post


Link to post
Share on other sites
Hijong parl
50 minutes ago, OrionSR said:

Oh, yeah. That always happens. That's from a buggy dead code segment. Delete those lines or comment them out - it won't hurt anything as they never run. Do a search if you need more specific information - lots of people have run into this problem.

 

I did it, Now I can do paramedic with maverick. It's simply awesome and very challenging, There are so many things to care when landing and taking off. The problem is that every ambulance cars are replaced to maverick chopper but it's not a fatal issue.

 

Now I want to do taxi missions with police maverick, Should I type #POLICEMAVERICK or #POLICE_MAVERICK ?

Share this post


Link to post
Share on other sites
OrionSR
Posted (edited)

Congratulations. Well done.
 

57 minutes ago, Hijong parl said:

There are so many things to care when landing and taking off. The problem is that every ambulance cars are replaced to maverick chopper but it's not a fatal issue.

It sounds like you changed references to the car generators that spawn parked cars as specific locations. Line like this can be found in the :Initial mission that sets up the map to work with this specific script.

014B: $2811 = init_parked_car_generator #AMBULAN color -1 -1 0 alarm 0 door_lock 0 0 10000 at 2033.888 -1432.67 16.6453 angle 177.829 

This might seem minor, but if you changed all references of ambulance to maverick then weird things might happen in other missions. Is Intensive Care the mission in LV with a bunch of ambulances driving around? Not sure what will happen if those are all mavericks. 

Limit your modification to two scripts, R3 and AMBULAN. Scripts are named with the 03A4: name_thread 'AMBULAN' command. Labels within this script will start with something like :AMBULAN_2895669. Labels are destinations for jump commands that look like, 0002: jump @AMBULAN_2895669. This lets you find your way around specific scripts and missions within the larger SCM file. 

 

Police Maverick: If you erase the existing entry and start typing a new one with the # symbol then Sanny will make suggestions. By the time you get to #PO it's pretty easy to find #POLMAV on the list. There are lots of standard references for this type of information. Start saving links to your favorites.

 

Don't worry if the words used in my opcodes don't match yours. The words don't do anything other than describe what the opcode is doing. This SCM was decompiled with a very old SASCM.ini.
The numbers in my labels are based on a thread+global offset setting in options. Your numbers will be different if you aren't using standard v1 scripts for PC or have the default (?) thread + local offset setting.

Edited by OrionSR

Share this post


Link to post
Share on other sites
Hijong parl
5 hours ago, OrionSR said:

Congratulations. Well done.
 

It sounds like you changed references to the car generators that spawn parked cars as specific locations. Line like this can be found in the :Initial mission that sets up the map to work with this specific script.

014B: $2811 = init_parked_car_generator #AMBULAN color -1 -1 0 alarm 0 door_lock 0 0 10000 at 2033.888 -1432.67 16.6453 angle 177.829 

This might seem minor, but if you changed all references of ambulance to maverick then weird things might happen in other missions. Is Intensive Care the mission in LV with a bunch of ambulances driving around? Not sure what will happen if those are all mavericks. 

Limit your modification to two scripts, R3 and AMBULAN. Scripts are named with the 03A4: name_thread 'AMBULAN' command. Labels within this script will start with something like :AMBULAN_2895669. Labels are destinations for jump commands that look like, 0002: jump @AMBULAN_2895669. This lets you find your way around specific scripts and missions within the larger SCM file. 

 

Police Maverick: If you erase the existing entry and start typing a new one with the # symbol then Sanny will make suggestions. By the time you get to #PO it's pretty easy to find #POLMAV on the list. There are lots of standard references for this type of information. Start saving links to your favorites.

 

Don't worry if the words used in my opcodes don't match yours. The words don't do anything other than describe what the opcode is doing. This SCM was decompiled with a very old SASCM.ini.
The numbers in my labels are based on a thread+global offset setting in options. Your numbers will be different if you aren't using standard v1 scripts for PC or have the default (?) thread + local offset setting.

 

Unfortunately changing #TAXI to #POLMAV causes another compile error, called 'ENTEXT_238 not found'. So I'll just stick with paramedic mission. It would be great if someone make a proper CLEO mod for this...

Share this post


Link to post
Share on other sites
Jack
Posted (edited)
On 7/30/2019 at 11:27 AM, Hijong parl said:

 

Unfortunately changing #TAXI to #POLMAV causes another compile error, called 'ENTEXT_238 not found'. So I'll just stick with paramedic mission. It would be great if someone make a proper CLEO mod for this...

I manage to hook up to the opcode without touching its default settings:

Spoiler

//    https://github.com/DK22Pac/plugin-sdk/
		#include "plugin.h"		

		using namespace plugin;		

		static int _ZN14CRunningScript17CollectParametersEPjs = 0x464080;
		static int ScriptParams = 0xA43C78;
		static int _ZN6CPools11ms_pPedPoolE = 0xB74490;
		static int CPools_CPed_AtHandle = 0x404910;
		static int _ZN14CRunningScript17UpdateCompareFlagEh = 0x4859D0;
		unsigned int opcode_hook = 0x4912C2;
		unsigned int opcode_hook_size = 0x1F;		

		DWORD loc_492AAB = 0x492AAB;		

		__declspec(naked) void opcode_new_pos() {
		    _asm {
		        mov eax,[eax+0x58C]
		        test eax,eax
		        je loc_4912E1
		        mov ax,[eax+0x22]
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1F1    //    MODEL_POLMAV
		        je loc_4912DC
		        cmp ax, 0x233    //    MODEL_RAINDANC
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax, 0x1A4    //    MODEL_TAXI
		        je loc_4912DC
		        cmp ax,0x1B6    //    MODEL_CABBIE
		        jne loc_4912E1
		    loc_4912DC:
		        mov byte ptr [esp+0x14],1
		    loc_4912E1:
		        mov ecx,0x4912E1
		        jmp ecx
		    }
		}		

		class SubMissionExtender {
		public:
		    SubMissionExtender() {
		        Events::gameProcessEvent += [] {
		            plugin::patch::Nop(opcode_hook, opcode_hook_size);
		            injector::MakeJMP(opcode_hook, opcode_new_pos);
		        };
		    }
		} subMissionExtender;


So now beside the default TAXI and CABBIE vehicles, taxi mission can be activated while flying POLMAV or RAINDANCE:
Place Asi Loader and SubMissionExtender.asi to the gta sa directory.


It works with the modified main.scm or without - it doesn't matter.

 

Edited by Jack

Share this post


Link to post
Share on other sites
Hijong parl
2 hours ago, Jack said:

I manage to hook up to the opcode without touching its default settings:

//    https://github.com/DK22Pac/plugin-sdk/
#include "plugin.h"

using namespace plugin;

static int _ZN14CRunningScript17CollectParametersEPjs = 0x464080;
static int ScriptParams = 0xA43C78;
static int _ZN6CPools11ms_pPedPoolE = 0xB74490;
static int CPools_CPed_AtHandle = 0x404910;
static int _ZN14CRunningScript17UpdateCompareFlagEh = 0x4859D0;
unsigned int opcode_hook = 0x4912C2;
unsigned int opcode_0602_size = 0x1F;

DWORD loc_492AAB = 0x492AAB;

__declspec(naked) void opcode_new_pos() {
    _asm {
        mov eax,[eax+0x58C]
        test eax,eax
        je loc_4912E1
        mov ax,[eax+0x22]
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1F1    //    MODEL_POLMAV
        je loc_4912DC
        cmp ax, 0x233    //    MODEL_RAINDANC
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax,0x1B6    //    MODEL_CABBIE
        jne loc_4912E1
    loc_4912DC:
        mov byte ptr [esp+0x14],1
    loc_4912E1:
        mov ecx,0x4912E1
        jmp ecx
    }
}

class SubMissionExtender {
public:
    SubMissionExtender() {
        Events::gameProcessEvent += [] {
            plugin::patch::Nop(opcode_hook, opcode_hook_size);
            injector::MakeJMP(opcode_hook, opcode_new_pos);
        };
    }
} subMissionExtender;

 


So now beside the default TAXI and CABBIE vehicles, taxi mission can be activated while flying POLMAV or RAINDANCE:
SubMissionExtender.SA.asi
It's an asi mod so you need:
Asi Loader
Place Asi Loader and SubMissionExtender.asi to the gta sa directory.


It works with the modified main.scm or without - it doesn't matter.

 

Thank you so much for your work ! Paramedic was quite frustrating to play with helicopter, but taxi driver feels properly balanced. It's very fun to transport peds and explore the city.

 

News chopper would be a better choice than raindance though.  News chopper is smaller/faster than maverick and Taxi driver doesn't need 4-seat vehicles. Playing taxi mission with Raindance was a bit annoying.

Share this post


Link to post
Share on other sites
Hijong parl
13 hours ago, Jack said:

I manage to hook up to the opcode without touching its default settings:

//    https://github.com/DK22Pac/plugin-sdk/
#include "plugin.h"

using namespace plugin;

static int _ZN14CRunningScript17CollectParametersEPjs = 0x464080;
static int ScriptParams = 0xA43C78;
static int _ZN6CPools11ms_pPedPoolE = 0xB74490;
static int CPools_CPed_AtHandle = 0x404910;
static int _ZN14CRunningScript17UpdateCompareFlagEh = 0x4859D0;
unsigned int opcode_hook = 0x4912C2;
unsigned int opcode_0602_size = 0x1F;

DWORD loc_492AAB = 0x492AAB;

__declspec(naked) void opcode_new_pos() {
    _asm {
        mov eax,[eax+0x58C]
        test eax,eax
        je loc_4912E1
        mov ax,[eax+0x22]
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1F1    //    MODEL_POLMAV
        je loc_4912DC
        cmp ax, 0x233    //    MODEL_RAINDANC
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax,0x1B6    //    MODEL_CABBIE
        jne loc_4912E1
    loc_4912DC:
        mov byte ptr [esp+0x14],1
    loc_4912E1:
        mov ecx,0x4912E1
        jmp ecx
    }
}

class SubMissionExtender {
public:
    SubMissionExtender() {
        Events::gameProcessEvent += [] {
            plugin::patch::Nop(opcode_hook, opcode_hook_size);
            injector::MakeJMP(opcode_hook, opcode_new_pos);
        };
    }
} subMissionExtender;

 


So now beside the default TAXI and CABBIE vehicles, taxi mission can be activated while flying POLMAV or RAINDANCE:
SubMissionExtender.SA.asi
It's an asi mod so you need:
Asi Loader
Place Asi Loader and SubMissionExtender.asi to the gta sa directory.


It works with the modified main.scm or without - it doesn't matter.

 

 

I'm about to make an asi file that allows to do taxi mission with News chopper instead of Raindance.

Should I just copy your source and change 0x233 to 0x1E8 (News chopper ID) then compile it, or are there any extra codes need to be written ? I never made asi file before that I don't know about it well.

Share this post


Link to post
Share on other sites
Hijong parl
Posted (edited)
2 hours ago, Hijong parl said:

 

I'm about to make an asi file that allows to do taxi mission with News chopper instead of Raindance.

Should I just copy your source and change 0x233 to 0x1E8 (News chopper ID) then compile it, or are there any extra codes need to be written ? I never made asi file before that I don't know about it well.

1dcbef71-1df9-461e-81d7-13f8ed00e324-ori

 

794b422d-df44-4402-a830-48b578202c4c-ori

 

fcac036e-dbdd-4687-a37c-d960bf4992f0-ori

 

 

I directly copied jack's script in asi sdk and only changed raindance id to news choppper, But the errors happen and I can't build asi file.

What's the problem and how to fix it ?

Edited by Hijong parl

Share this post


Link to post
Share on other sites
Hijong parl
On 7/30/2019 at 7:01 PM, Jack said:

I manage to hook up to the opcode without touching its default settings:

//    https://github.com/DK22Pac/plugin-sdk/
#include "plugin.h"

using namespace plugin;

static int _ZN14CRunningScript17CollectParametersEPjs = 0x464080;
static int ScriptParams = 0xA43C78;
static int _ZN6CPools11ms_pPedPoolE = 0xB74490;
static int CPools_CPed_AtHandle = 0x404910;
static int _ZN14CRunningScript17UpdateCompareFlagEh = 0x4859D0;
unsigned int opcode_hook = 0x4912C2;
unsigned int opcode_0602_size = 0x1F;

DWORD loc_492AAB = 0x492AAB;

__declspec(naked) void opcode_new_pos() {
    _asm {
        mov eax,[eax+0x58C]
        test eax,eax
        je loc_4912E1
        mov ax,[eax+0x22]
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1F1    //    MODEL_POLMAV
        je loc_4912DC
        cmp ax, 0x233    //    MODEL_RAINDANC
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax, 0x1A4    //    MODEL_TAXI
        je loc_4912DC
        cmp ax,0x1B6    //    MODEL_CABBIE
        jne loc_4912E1
    loc_4912DC:
        mov byte ptr [esp+0x14],1
    loc_4912E1:
        mov ecx,0x4912E1
        jmp ecx
    }
}

class SubMissionExtender {
public:
    SubMissionExtender() {
        Events::gameProcessEvent += [] {
            plugin::patch::Nop(opcode_hook, opcode_hook_size);
            injector::MakeJMP(opcode_hook, opcode_new_pos);
        };
    }
} subMissionExtender;

 


So now beside the default TAXI and CABBIE vehicles, taxi mission can be activated while flying POLMAV or RAINDANCE:
SubMissionExtender.SA.asi
It's an asi mod so you need:
Asi Loader
Place Asi Loader and SubMissionExtender.asi to the gta sa directory.


It works with the modified main.scm or without - it doesn't matter.

 

 

I still couldn't figure out how to replace raindance to news chopper and compile it to asi file. Can you help me?

Share this post


Link to post
Share on other sites
Jack

You can't compile because you didn't install plugin-sdk.
You should remove all those quotes and stop double posting (it's against the rules).

Share this post


Link to post
Share on other sites
Wesser
Posted (edited)

@Hijong parl, in response to your request, I take the chance to show off a reliable way to tamper with the main script at runtime:

// Enable GTA:SA SCR mode.

{$CLEO}

const
    _MemCopy = 0x004F2F10 // void *MemCopy(void *dest, const void *src, size_t count) // workalike
end
const
    _CTheScripts__LargestMissionScriptSize = 0x00A444C0 // static int CTheScripts::LargestMissionScriptSize
    _CTheScripts__MainScriptSize           = 0x00A444C4 // static int CTheScripts::MainScriptSize
    _CTheScripts__ScriptSpace              = 0x00A49960 // static unsigned char CTheScripts::ScriptSpace[269000]
end

/*
    SA PC 1.0

    Main script size: 194146b (remaining 5854b)
    Largest mission script size: 68439b (remaining 561b)
*/

0002: goto @script_start
hex
    FF
end

:_aChunkInfo
hex
    18000000 00000000 @r3_110
    18000000 00000000 @r3_187
    23000000 00000000 @r3_367
    23000000 00000000 @r3_555
    18000000 00000000 @taxiodd_104
    23000000 00000000 @taxiodd_179
    33000000 00000000 @taxiodd_2575
    18000000 00000000 @taxiodd_2884
    18000000 00000000 @taxiodd_3350
    3B000000 00000000 @taxiodd_6453
    37000000 00000000 @taxiodd_18422
end

:_r3_SCRIPT_NAME
hex
    A403 09 "R3" 00 00 00 00 00 00
end

:r3_110
hex
    D600 04 1A              // 00000000 ANDOR 26
    0206 02 0C00            // 00000004 IS_CHAR_IN_TAXI scplayer
    DD00 02 0C00 05 E801    // 00000009 IS_CHAR_IN_MODEL scplayer HELI_VCNMAV
    0200 01 00000000        // 00000011 GOTO r3_119
end

:r3_187
hex
    D600 04 15              // 00000000 ANDOR 21
    0206 02 0C00            // 00000004 IS_CHAR_IN_TAXI scplayer
    DD00 02 0C00 05 E801    // 00000009 IS_CHAR_IN_MODEL scplayer HELI_VCNMAV
    0200 01 00000000        // 00000011 GOTO r3_196
end

:r3_367
hex
    D600 04 00              // 00000000 ANDOR 0
    5602 02 0800            // 00000004 IS_PLAYER_PLAYING player
    4D00 01 00000000        // 00000009 GOTO_IF_FALSE r3_395
    D600 04 01              // 00000010 ANDOR 1
    DD80 02 0C00 05 E801    // 00000014 NOT IS_CHAR_IN_MODEL scplayer HELI_VCNMAV
    0200 01 00000000        // 0000001C GOTO r3_376
end

:r3_555
hex
    D600 04 00              // 00000000 ANDOR 0
    5602 02 0800            // 00000004 IS_PLAYER_PLAYING player
    4D00 01 00000000        // 00000009 GOTO_IF_FALSE r3_583
    D600 04 01              // 00000010 ANDOR 1
    DD80 02 0C00 05 E801    // 00000014 NOT IS_CHAR_IN_MODEL scplayer HELI_VCNMAV
    0200 01 00000000        // 0000001C GOTO r3_564
end

:taxiodd_104
hex
    D600 04 15              // 00000000 ANDOR 21
    0206 02 0C00            // 00000004 IS_CHAR_IN_TAXI scplayer
    DD00 02 0C00 05 E801    // 00000009 IS_CHAR_IN_MODEL scplayer HELI_VCNMAV
    0200 01 8FFFFFFF        // 00000011 GOTO r3_113
end

:taxiodd_179
hex
    D600 04 00              // 00000000 ANDOR 0
    A904 02 0C00            // 00000004 IS_CHAR_IN_ANY_HELI scplayer
    4D00 01 45FFFFFF        // 00000009 GOTO_IF_FALSE taxiodd_187
    D600 04 00              // 00000010 ANDOR 0
    8581 03 2500 05 FA00    // 00000014 NOT IS_CAR_HEALTH_GREATER player_taxi 250
    0200 01 39FFFFFF        // 0000001C GOTO taxiodd_199
end

:taxiodd_2575
hex
    4D00 01 B1F5FFFF    // 00000000 GOTO_IF_FALSE taxiodd_2639
    D600 04 00          // 00000007 ANDOR 0
    A904 02 0C00        // 0000000B IS_CHAR_IN_ANY_HELI scplayer
    4D00 01 EAF5FFFF    // 00000010 GOTO_IF_FALSE taxiodd_2582
    D600 04 15          // 00000017 ANDOR 21
    C181 03 5900        // 0000001B NOT IS_CAR_STOPPED taxi_car
    F301 03 5900        // 00000020 IS_CAR_IN_AIR_PROPER taxi_car
    4D00 01 EAF5FFFF    // 00000025 GOTO_IF_FALSE taxiodd_2582
    0200 01 B1F5FFFF    // 0000002C GOTO taxiodd_2639
end

:taxiodd_2884
hex
    D600 04 15              // 00000000 ANDOR 21
    0206 02 0C00            // 00000004 IS_CHAR_IN_TAXI scplayer
    DD00 02 0C00 05 E801    // 00000009 IS_CHAR_IN_MODEL scplayer HELI_VCNMAV
    0200 01 B3F4FFFF        // 00000011 GOTO r3_2893
end

:taxiodd_3350
hex
    D600 04 15              // 00000000 ANDOR 21
    A904 02 0C00            // 00000004 IS_CHAR_IN_ANY_HELI scplayer
    8501 03 5900 05 9001    // 00000009 IS_CAR_HEALTH_GREATER taxi_car 400
    0200 01 DEF2FFFF        // 00000011 GOTO taxiodd_3362
end

:taxiodd_6453
hex
    E901 03 5900 03 9500                // 00000000 GET_MAXIMUM_NUMBER_OF_PASSENGERS taxi_car no_of_passenger_seats
    D600 04 00                          // 00000008 ANDOR 0
    1900 03 9500 04 01                  // 0000000C IS_INT_LVAR_GREATER_THAN_NUMBER no_of_passenger_seats 1
    4D00 01 00000000                    // 00000013 GOTO_IF_FALSE taxiodd_6453_45
    0600 03 8C00 04 00                  // 0000001A SET_LVAR_INT flag_right_side FALSE
    0200 01 C4E6FFFF                    // 00000021 GOTO taxiodd_6460
                                        // 00000028 taxiodd_6453_45:
    CA05 03 5800 03 5900 04 FE 04 00    // 00000028 TASK_ENTER_CAR_AS_PASSENGER taxi_ped taxi_car -2 0
    0200 01 8CE6FFFF                    // 00000034 GOTO taxiodd_6516
end

:taxiodd_18422
hex
    0A00 03 7300 05 F401    // 00000000 ADD_VAL_TO_INT_LVAR in_a_row_cash 500
    D600 04 00              // 00000008 ANDOR 0
    A904 02 0C00            // 0000000C IS_CHAR_IN_ANY_HELI scplayer
    4D00 01 02B8FFFF        // 00000011 GOTO_IF_FALSE taxiodd_18430
    2702 03 5900 03 2400    // 00000018 GET_CAR_HEALTH taxi_car taxi_health
    0A00 03 2400 05 5E01    // 00000020 ADD_VAL_TO_INT_LVAR taxi_health 350
    2402 03 5900 03 2400    // 00000028 SET_CAR_HEALTH taxi_car taxi_health
    0200 01 02B8FFFF        // 00000030 GOTO taxiodd_18430
end

:script_start
0AAA: get_script_struct_named 'r3' store_to [email protected]
while [email protected] == 0
    0001: wait 0
    0AAA: get_script_struct_named 'r3' store_to [email protected]
end

0A8E: [email protected] = [email protected] + 0x10 // offsetof(CRunningScript, m_pStartAddress)
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
if
    [email protected] <> 0
then
    0A93: terminate_this_custom_script
end

0A8E: [email protected] = _CTheScripts__ScriptSpace + 3
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
[email protected] += _CTheScripts__ScriptSpace
0A8E: [email protected] = [email protected] + 7
0A8D: read_memory [email protected] size 1 vp FALSE store_to [email protected]
if
08B7:   is_bit_set [email protected] bit 7
then
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    0A8E: [email protected] = [email protected] + 4
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    08C3: clear_bit [email protected] bit 31
else
    0A8D: read_memory _CTheScripts__MainScriptSize size 4 vp FALSE store_to [email protected]
    0A8D: read_memory _CTheScripts__LargestMissionScriptSize size 4 vp FALSE store_to [email protected]
    [email protected] += 200000
end

var
    [email protected]: Integer
    [email protected]: Integer
    [email protected]: Integer
    [email protected]: Integer
    [email protected]: Integer
    [email protected]: Integer
end

0A9F: get_this_script_struct [email protected]
[email protected] += 0x10 // offsetof(CRunningScript, m_pStartAddress)
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
      
0A8F: [email protected] = [email protected] - @_aChunkInfo
0A8E: [email protected] = [email protected] + 0x84
[email protected] = [email protected]

repeat
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    0A8E: [email protected] = [email protected] + [email protected]
    if
        [email protected] >= 200000
    then
        0A8E: [email protected] = [email protected] + [email protected]
        if
            [email protected] >= 269000
        then
            0A93: terminate_this_custom_script
        end
        [email protected] += 4
        0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
        [email protected] = [email protected]
    else
        [email protected] += 4
        0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
        [email protected] = [email protected]
    end
    [email protected] += 8
until [email protected] >= [email protected]

0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
[email protected] += 4
08BD: set_bit [email protected] bit 31
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

const
    _memcmp = [email protected] // int memcmp(const void *buffer1, const void *buffer2, size_t count)
end

if
0AA9:   is_original_version
then
    _memcmp = 0x00830F00
else
    _memcmp = 0x00830F40
end

0050: gosub @get_r3_start_address
while [email protected] == 0
    0001: wait 0
    0050: gosub @get_r3_start_address
end

0A8F: [email protected] = [email protected] - _CTheScripts__ScriptSpace

0A8F: [email protected] = [email protected] - @r3_110
0A8E: [email protected] = [email protected] + 0x14
0A8E: [email protected] = [email protected] + 119
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

0A8F: [email protected] = [email protected] - @r3_187
0A8E: [email protected] = [email protected] + 0x14
0A8E: [email protected] = [email protected] + 196
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

0A8F: [email protected] = [email protected] - @r3_367
0A8E: [email protected] = [email protected] + 0x0C
0A8E: [email protected] = [email protected] + 395
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
0A8E: [email protected] = [email protected] + 0x1F
0A8E: [email protected] = [email protected] + 376
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

0A8F: [email protected] = [email protected] - @r3_555
0A8E: [email protected] = [email protected] + 0x0C
0A8E: [email protected] = [email protected] + 583
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
0A8E: [email protected] = [email protected] + 0x1F
0A8E: [email protected] = [email protected] + 564
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

0A8F: [email protected] = [email protected] - @taxiodd_6453
0A8E: [email protected] = [email protected] + 0x16
0A8E: [email protected] = [email protected] + 0x70
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
[email protected] += 0x28
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

[email protected] = [email protected]

repeat
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    [email protected] += 4
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    [email protected] += 4
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    [email protected] += 4
    [email protected] += _CTheScripts__ScriptSpace
    0A8F: [email protected] = [email protected] - [email protected]
    0AA5: call_function _MemCopy push 3 pop 3 count [email protected] src [email protected] dest [email protected]
until [email protected] >= [email protected]

[email protected] += 4

0A8E: [email protected] = [email protected] + 110
0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
[email protected] += 3
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
[email protected] += 0x0C

0A8E: [email protected] = [email protected] + 187
0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
[email protected] += 3
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
[email protected] += 0x0C

0A8E: [email protected] = [email protected] + 367
0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
[email protected] += 3
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
[email protected] += 0x0C

0A8E: [email protected] = [email protected] + 555
0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
[email protected] += 3
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
[email protected] += 0x0C

0A8E: [email protected] = _CTheScripts__ScriptSpace + 200000

0A8E: [email protected] = [email protected] + 226
0A8D: read_memory [email protected] size 2 vp FALSE store_to [email protected]
[email protected] += _CTheScripts__ScriptSpace

var
    [email protected]: Integer
    [email protected]: Integer
end

[email protected] = FALSE

while true
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    if
        [email protected] <> [email protected]
    then
        if
            [email protected] == FALSE
        then
            [email protected] = [email protected]
            0A8E: [email protected] = [email protected] + 104
            0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
            [email protected] += 3
            0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
            0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

            [email protected] += 0x0C
            0A8E: [email protected] = [email protected] + 179
            0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
            [email protected] += 3
            0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
            0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

            [email protected] += 0x0C
            0A8E: [email protected] = [email protected] + 2575
            0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
            [email protected] += 3
            0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
            0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

            [email protected] += 0x0C
            0A8E: [email protected] = [email protected] + 2884
            0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
            [email protected] += 3
            0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
            0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

            [email protected] += 0x0C
            0A8E: [email protected] = [email protected] + 3350
            0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
            [email protected] += 3
            0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
            0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

            [email protected] += 0x0C
            0A8E: [email protected] = [email protected] + 6453
            0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
            [email protected] += 3
            0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
            0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE

            [email protected] += 0x0C
            0A8E: [email protected] = [email protected] + 18422
            0AA5: call_function _MemCopy push 3 pop 3 count 3 src [email protected] dest [email protected]
            [email protected] += 3
            0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
            0A8C: write_memory [email protected] size 4 value [email protected] vp FALSE
        end
    end
    [email protected] = [email protected]
    0001: wait 0
end

:get_r3_start_address
var
    [email protected]: Integer
    [email protected]: Integer
end
0A8E: [email protected] = [email protected] + 0x14 // offsetof(CRunningScript, m_PC)
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
0A8E: [email protected] = [email protected] + 0xCC // offsetof(CRunningScript, m_wakeTime)
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
01BD: get_game_timer [email protected]
0062: [email protected] -= [email protected]
if
    [email protected] == 70
then
    0A8F: [email protected] = [email protected] - 0x0F
    0A8F: [email protected] = [email protected] - @_r3_SCRIPT_NAME
    0AA7: call_function_ret _memcmp push 3 pop 3 count 11 buffer2 [email protected] buffer1 [email protected] result [email protected]
    if
    08B7:   is_bit_set [email protected] bit 0
    then
        [email protected] = [email protected]
        0051: return
    end
    [email protected] += 0x0F
    0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
    [email protected] -= 4
    [email protected] += _CTheScripts__ScriptSpace
else
    if
        [email protected] <> 5000
    then
        [email protected] = 0
        0051: return
    end
    [email protected] += 3
end
0A8D: read_memory [email protected] size 4 vp FALSE store_to [email protected]
[email protected] -= 0x0F
[email protected] += _CTheScripts__ScriptSpace
0051: return

 

Edited by Wesser

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.