Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

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

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

C++ SCM Injection


DaN`
 Share

Recommended Posts

Elo.

 

I've started to understand all the Script Command injection stuff with C++ lately. I know how to insert cars into the game with the press of a key, but I'm abit stuck on 'create_pickup'. I tried creating a Bribe when a key is pressed but when compile it came up with an error. I was wondering if anyone could post a Code Snippet of a similar code, it doesn't have to be a Bribe.

 

Thanks in advance.

Link to comment
Share on other sites

I'm not sure you can simply create a pickup like that at all, you just set up a pickup spawn point, like car generators. And not many people in here use the C++ hook so it's doubtful many people will be able to help (though I may be completely wrong).

Link to comment
Share on other sites

Ok, no problem. Didn't think I would get much of a response anyway. Thanks.

I work pretty exclusively with the SCM hooks - code/game please?

I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets

Link to comment
Share on other sites

Game: GTA:San Andreas

 

Basically, I just want to know how to get the 'SCRIPT_COMMAND' bit right, aswell as any other stuff you may spot wrong.

 

The following is from a d3d9 hook, in 'Custom.cpp':

 

 

ScriptCommand(&create_pickup, bribe, *fX, *fY, *fZ, help);

 

Note: fX, fY, fZ is part of a Float.

 

The following is from 'Custom.h'

 

 

const SCRIPT_COMMAND create_pickup              = { 0x0213, "help" }; // create_pickup

 

 

Where you can see the word 'help' is basically where I do need help. I get confused with it, I have the memory address right (at least I think I do) and the Opcode etc.

 

If you need a further elaboration, I'll be happy to add.

Edited by DaN`
Link to comment
Share on other sites

random_download

That is the parameter types, if I remember right i = int, f = float, s = string and v = var. So it would be "iifffv"

Link to comment
Share on other sites

The "help" section you're looking for defines the parameters for the opcode. For example:

 

 

DEFINE_OPCODE(create_actor, 0x009A, "iifffv");

 

 

In this opcode (which creates a new actor), the first "i" is the ped type, the second "i" is the model reference via the peds.ide, the three "f"s are the x,y,z floats, and the "v" is the variable the the actor will be referenced as. MOST (if not all) creation type opcodes in the SCM hooks put the variable reference at the END of the command, as opposed to the beginning, like in the traditional mission builders. But when you want to use that variable, it usually goes in the beginning, like this:

 

 

DEFINE_OPCODE(actor_task_fall_down, 0x05BB, "vii");

 

 

Which puts the actor variable in the beginning.

 

I've never used the create_pickup command, but if Y_Less is right and it IS set up like an init car generator, then the code SHOULD be:

 

 

DEFINE_OPCODE(create_pickup, 0x0213, "iifffv);

 

 

where "i" is the objects model number. In this case, it's a bribe, so your code would be

 

 

ScriptCommand(&create_pickup, -94, 15, *fX, *fY, *fZ, BRIBE);

 

 

Where BRIBE is your variable, so you know what to use when you wish to destroy it, reference it, etc.

 

Any more questions, feel free to ask. smile.gif

 

EDIT: Fixed the opcode; I was looking at the wrong one)...

Edited by ceedj

I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets

Link to comment
Share on other sites

Thanks for the reply.

 

As I said, I'm beginning to understand all this stuff. What I don't understand is where to put the 'DEFINE_OPCODE' function. I tried putting it in 'GameScripting.h' underneath the 'SCRIPT_COMMAND' functions but when I attempted to build, I got various errors.

 

If you could explain it as clear as possible, I would be very grateful.

Link to comment
Share on other sites

If you're using a d3d9 hook (which I've never used) put it in Custom.h, like you had before. You MAY need to set up a function for it, but again, I've never used.

 

If you're using Spookie's SCM Hook, put it in GameScripting.h, and add a function in ScriptClasses.h/.cpp.

 

If you're using op9080's SA Hook, add it to Opcodes.h and call it as you would your other functions.

 

Basically, set it up the same way you did for spawing cars in the rest of your code.

I'm actually not against democracy though. I'm against things I think are f*cking stupid. I think this is f*cking stupid. - Sweets

Link to comment
Share on other sites

just fyi, i don't think you even need those partypes for op9080's sa hook. and from what i've seen in the source, it's simply ignored (i can't imagine what it'd be used for anyway). so leaving that empty should work just as well.

Link to comment
Share on other sites

While we are talking about scm hook d3d9, any ideas how to make an actor shoot on key press ??

 

Any help would be great

 

FalconGT.

Link to comment
Share on other sites

Hi thanks for the useful information. Got it all setup, all I need to know now is about the function in ScriptClasses.h/cpp, if you've got a snippet from that, could I have it if possible.

 

Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Maybe you have already got this, but here is how I do it.

 

 

in Gamescripting.hconst SCRIPT_COMMAND create_pickup = { 0x0213, "iifffv" };then in the file of your choice...ScriptCommand(&create_pickup, 1274, 2, fX, fY, fZ, &pickup);

 

 

As you can see, the second integer should be 2 to create an object which can be 'picked up'. &pickup is simply an int and fX fY fZ are of course the float co-ordinates.

 

The police bribe, health, armor and adrenaline are all located in data/maps/generic/dynamic.ide

 

Weapon pickups spawn successfully, as well as any other ide object. For the first time I've used adrenaline in SA, and it isn't as good as in VC, IMHO.

 

Don't try numbers which aren't in one of the ide files, unless you like crashing your game.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

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