GTAMP.com
https://gtamp.com/forum/

GTA2 memory addresses
https://gtamp.com/forum/viewtopic.php?f=4&t=700
Page 4 of 5

Author:  Logofero [ Sun Jan 14, 2018 1:33 pm ]
Post subject:  Re: GTA2 memory addresses

Nobody not is found a method to create an object/car/character? Or call spawn like in GTA3/VC/SA

Author:  Sektor [ Sun Feb 11, 2018 2:04 pm ]
Post subject:  Re: GTA2 memory addresses

I don't know how to create objects, I can only move them around.

Here are the stats shown at the end of the level:

vehicles_hijacked: 0x5E3CC4, 0x50C;
auto_damage_cost: 0x5E3CC4, 0x52C;
civilians_run_down: 0x5E3CC4, 0x510;
civilians_murdered: 0x5E3CC4, 0x514;
lawmen_killed: 0x5E3CC4, 0x518;
gang_members_killed: 0x5E3CC4, 0x51C;
fugitive_factor: 0x5E3CC4, 0x530;

I thought it would be interesting to display them in realtime. Useful if you wanted to try a pacifist speedrun.

Author:  Logofero [ Thu Feb 22, 2018 12:12 am ]
Post subject:  Re: GTA2 memory addresses

Does anyone know a pointer in the name car?

ped struct + 0x16C = car pointer = car struct + ? = name car

Added:

I found a way to turn on/off the lights and open/close the doors in the car.
Code:
ped struct + 0x16C = car struct
car struct + 0x8 = [byte] front left light (set 64/0 on/off light, car struct + 0x8 = +4 left light crash decal)
car struct + 0xA = [byte] front right light (set 128/0 on/off light, car struct + 0x8 = +8 right light crash decal)

Author:  Logofero [ Fri Feb 23, 2018 12:44 am ]
Post subject:  Re: GTA2 memory addresses

Sector, you have set an example in the subject viewtopic.php?f=4&t=815#p10212 you know the pointer on the arrows or offset (all arrow data)?

Author:  Sektor [ Fri Feb 23, 2018 2:25 am ]
Post subject:  Re: GTA2 memory addresses

http://gtamp.com/GTA2/gta2arrows.ct

Author:  Logofero [ Fri Feb 23, 2018 2:47 am ]
Post subject:  Re: GTA2 memory addresses

Sektor wrote:
http://gtamp.com/GTA2/gta2arrows.ct

Thank you. References are useful.

And do you know the address objective type (folowing at point) for ped?

Author:  Sektor [ Fri Feb 23, 2018 2:53 am ]
Post subject:  Re: GTA2 memory addresses

No, I haven't found the arrows pointing location. I looked for it since it would be useful in GTA2 Radar but no luck.

Author:  Logofero [ Fri Feb 23, 2018 3:05 am ]
Post subject:  Re: GTA2 memory addresses

Sektor wrote:
No, I haven't found the arrows pointing location. I looked for it since it would be useful in GTA2 Radar but no luck.

I meant it. http://projectcerbera.com/gta/2/tutorials/character-ai
Code:
SET_CHAR_OBJECTIVE (name, OBJECTIVE_TYPE)
SET_CHAR_OBJECTIVE (name, OBJECTIVE_TYPE, X, Y, Z)

Author:  Logofero [ Sat Feb 24, 2018 1:51 am ]
Post subject:  Re: GTA2 memory addresses

I found some useful addresses for cars. Changes the status of the engine, light, door locks and car acceleration.
Code:
car struct + 0x9C = [byte] engine state: 0 disabled, 1 off (set 2 engine and light off), 3 on (set 4 on engine and light)
car struct + 0x98 = [byte] door lock: 1 locked, 2 unlocked
car struct + 0x84 = [byte] car model: 0-86, 77 no moved (load handling from nyc.gci)

Can anyone know the address for changing the color and speed of car?

Edited: found car model.

Author:  BeepBoop [ Sat Feb 24, 2018 5:16 am ]
Post subject:  Re: GTA2 memory addresses

I know the color of the car address for cheat engine.

"GTA2.EXE"+0027C274 (2 bytes)
Offset #1 = 0x24
Offset #2 = 0x50

Tell me if it works or not.

Author:  Logofero [ Sat Feb 24, 2018 12:18 pm ]
Post subject:  Re: GTA2 memory addresses

BeepBoop wrote:
I know the color of the car address for cheat engine.

"GTA2.EXE"+0027C274 (2 bytes)
Offset #1 = 0x24
Offset #2 = 0x50

Tell me if it works or not.

–°rash game and color is not displayed.

I thought the color should be somewhere in the structure of the car or in the structure of its sprite, but I did not find it there. Maybe someone can find (full example get car, sprite struct):
Code:
0x5EB4FC = ped offset = ped offset + 0x4 = array ped pointer + 0xC4 = ped pointer = ped struct
ped struct + 0x16C = car pointer = car struct
car struct + 0x58 = sprite pointer = car sprite struct

Author:  Logofero [ Sat Feb 24, 2018 3:18 pm ]
Post subject:  Re: GTA2 memory addresses

Found car emergy siren, simulation button horn and enable signalisation sound:
Code:
car struct + 0xA4 = [byte] emergy siren: 4 on, 2 off (in emergy cars)
car struct + 0xA7 = [byte] simulation button horn: 248 press (set 255), 0 up
car struct + 0x8E = [byte] signalisation sound: 1 on, 0 off

Author:  BeepBoop [ Sat Feb 24, 2018 8:25 pm ]
Post subject:  Re: GTA2 memory addresses

Can you use multiple offsets?


For Example: car struct + 0x24 + 0x50 = Current car color.

Author:  Logofero [ Sun Feb 25, 2018 2:49 am ]
Post subject:  Re: GTA2 memory addresses

BeepBoop wrote:
Can you use multiple offsets?


For Example: car struct + 0x24 + 0x50 = Current car color.

address + offset, but this is when the offset is needed. When do I need to get the pointer I'm using. method of

example get scripts/struct.txt
Code:
while(true)
    if (IsKeyDown(13)) then -- For write in MISI.log ped_struct and car_struct down key ENTER.
        local address = tonumber("0x5EB4FC") -- Ped offset found by Sector
        local offset = 0x4
        local ped_ptr = ReadProcessMemory(address, 4)
        ped_ptr = ped_ptr + offset
        ped_ptr = ReadProcessMemory(ped_ptr, 4)
        local ped_struct = ReadProcessMemory(ped_ptr + 0xC4, 4) -- Get struct ped ID 1 (it player 1)
        if (ped_struct ~= 0) then -- Check player 1 exists
            local car_struct = ReadProcessMemory(ped_struct + 0x16C, 4)
            WriteInLog(string.format("Get ped struct %X car struct %X\n", ped_struct, car_struct))
        end
    end
    wait(200)
end

The presented syntax example is used in MISI

Author:  Logofero [ Sun Feb 25, 2018 12:38 pm ]
Post subject:  Re: GTA2 memory addresses

The car color works. Thanks BeepBoop viewtopic.php?f=4&t=700&start=60#p10567

get car color scripts/carcolor.txt
Code:
while(true)
    if (IsKeyDown(13)) then -- Get color down key ENTER.
        local address = tonumber("0x5EB4FC") -- Ped offset found by Sector
        local offset = 0x4
        local ped_ptr = ReadProcessMemory(address, 4)
        ped_ptr = ped_ptr + offset
        ped_ptr = ReadProcessMemory(ped_ptr, 4)
        local ped_struct = ReadProcessMemory(ped_ptr + 0xC4, 4) -- Get struct ped ID 1 (it player 1)
        if (ped_struct ~= 0) then -- Check player 1 exists
            local car_struct = ReadProcessMemory(ped_struct + 0x16C, 4)
            if (car_struct ~= 0) then -- Check car exists
                local car_ptr = ReadProcessMemory(car_struct + 0x50, 4) -- Car color found by BeepBoop
                local car_color = ReadProcessMemory(car_ptr + 0x24, 2)
                WriteInLog(string.format("Get ped struct %X car struct %X car color %d\n", ped_struct, car_struct, car_color))
            end
        end
    end
    wait(200)
end

Now need to get the name and speed of the car.

Author:  Logofero [ Sat Mar 10, 2018 5:39 pm ]
Post subject:  Re: GTA2 memory addresses

Does anyone have addresses for setting the volume of effects and music? Or C/C++ interfaces to configure the sound device GTA2.

This is necessary to turn off the radio in the car.

Author:  BeepBoop [ Sun Mar 11, 2018 3:00 am ]
Post subject:  Re: GTA2 memory addresses

I've found the music and effects volume addresses, but changing them doesn't do anything. You can change the radio/effects volume in the GTA 2 manager while in-game without having to restart.

Author:  Logofero [ Sun Mar 11, 2018 10:54 am ]
Post subject:  Re: GTA2 memory addresses

BeepBoop wrote:
I've found the music and effects volume addresses, but changing them doesn't do anything. You can change the radio/effects volume in the GTA 2 manager while in-game without having to restart.

A pro manager can not be a speech that only works for manual tuning.

I just need a rewritable memory address. I found it but it was in a heap of other addresses and it was not possible to weed out. Need a pointer for device Music/SFX (in RegEdit it GTA2/Sound keys: CDVol and SFXVol). Or can anyone know the sound API for controlling the current sound device GTA2.

Author:  Logofero [ Fri Mar 16, 2018 9:44 pm ]
Post subject:  Re: GTA2 memory addresses

I tried to change the position/angle of the object only z changes. The x, y coordinates are read-only? Sector, do you have an address for changing x, y, z (to write) the object?

I used:
Code:
-- Since: v0.2.1b
function SetObjPos(obj, x, y, z)
    local obj_ptr = ReadProcessMemory(obj + 0x4, 4)
    WriteProcessMemory(obj_ptr + 0x14, x * 16384, 4)
    WriteProcessMemory(obj_ptr + 0x18, y * 16384, 4)
    WriteProcessMemory(obj_ptr + 0x1C, z * 16384, 4)
end

while (true) do
    if (IsKeyDown(0x4)) then -- Down key middle mouse wheel
        -- Here code create object or get obj struct
        SetObjPos(obj, 10.0, 30.0, 5.0) -- Changed only z
    end
end

Author:  Sektor [ Fri Mar 16, 2018 10:00 pm ]
Post subject:  Re: GTA2 memory addresses

They're not read only but maybe something else has to change to trigger the game to redraw. If you try with an animated object like a rocket, it should update instantly.

Page 4 of 5 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/