GTA: Modification Area

A website for the GTA modding scene

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Big-game starts raising Schneider's profile
Sun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Thu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Thu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Thu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Sat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Fri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Fri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Tue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Mon Oct 12, 2009 6:45 am by Adler

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Affiliates
image

Image

Image

Image

Image

Image

Image

Image

Image

Image

image

Image

steve-m.com

Image


----- Русский -----

Если ваш сайт содержит большую коллекцию SCM/CLEO-скриптов (больше 16), напишите на мой e-mail, и я добавлю его в список. Приветствуются скрипты, которые не встречаются на других сайтах ... Спасибо. ))))


----- English -----

If your website has a big enough collection of SCM/CLEO scripts (more than 16) notify me by e-mail
, and I will add it to the list. The unique scripts are preferable ... Thank you. ))))

Log in

I forgot my password



December 2016
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 

Calendar Calendar


You are not connected. Please login or register

Handle structure obtained from cars, objects, peds, etc

View previous topic View next topic Go down  Message [Page 1 of 1]



The original was posted in Russian (on my PC) and also in Japanese on another site.


When getting actors, objects, cars, or whatever, there is a investing way of obtaining them. Usually the "simple" coder will use opcode 08E5 to get actors, but what about objects, etc? Here is a interesting way to get things.


Array index structure (ID) and the value stored in the SCM (Handle) in comparison with the rules,
the following equation remains true.



Code:

Handle = ID * 256 + N (128> N ≧ 0)


This code gets the handle of all actors,


Code:

for 28@ = 0 to 35584 step 256
    0085: 26@ = 28@ // (int)
    for 29@ = 0 to 127
        if and
        056D:  actor 26@ defined
        803C:  not $PLAYER_ACTOR == 26@ // (int)
        then
            0321: kill_actor 26@
            break
        end
        000A: 26@ += 1
    end
end


it may require a little wait, because it's a big task for the game engine.

For example use this code:


Code:

0A8D: 27@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 27@ += 0x4
0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0
for 28@ = 0 to 35584 step 0x100
    0A8D: 26@ = read_memory 27@ size 1 virtual_protect 0
    000A: 27@ += 0x1
    if and
    0029:  26@ >= 0x00
    001B:  0x80 > 26@
    then
        005A: 26@ += 28@ // (int)
        if
        803C:  not  $PLAYER_ACTOR == 26@ // (int)
        then
            0321: kill_actor 26@
        end
    end
end


This code will kill everyone, other than CJ. This included Carl's friends, peds walking the street, and scripted actors.

Here are some values, you may need to use, depending if you're getting a actor, vehicle or object.


Code:

Peds: 35,584 = (maximum number of people (140) -1) * 0x100 · 0xB74490

Cars: 27,904 = (maximum number of vehicles (110) -1) * 0x100 · 0xB74494

Objects: 89,344 = (maximum number of objects (350) -1) * 0x100 · 0xB7449C


Here is an example script, this code will check if any vehicle is touching CJ's car, if it is, then that persons car who damaged CJ's new paint job gets blown up in his/her car.


Code:

{$CLEO}

0000:

:Start
while true
wait 250
if
  Player.Defined($PLAYER_CHAR)
then
    if
      Actor.Driving($PLAYER_ACTOR)
  then
    break
        end
    end
end

03C0: 30@ = actor $PLAYER_ACTOR car


:MainCheck
wait 0
0A8D: 4@ = read_memory 0xB74494 size 4 virtual_protect 0
000A: 4@ += 0x4
0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0
for 5@ = 0 to 27904 step 0x100
    0A8D: 3@ = read_memory 4@ size 1 virtual_protect 0
    000A: 4@ += 0x1
    if and
    0029:  3@ >= 0x00
    001B:  0x80 > 3@
    then
        005A: 3@ += 5@ // (int)
        if
        8119:  not car 3@ wrecked
        then
            for 31@ = 0 to 3
                if
                09CB:  vehicle 3@ colliding_with_vehicle 30@
                then
                  02AC: set_car 30@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
                  020B: explode_car 3@ // versionA
                  wait 200
                  02AC: set_car 30@ immunities BP 0 FP 0 EP 0 CP 0 MP 0
            break
                end
            end
        end
    end
end


if     
  Actor.Driving($PLAYER_ACTOR)
then
    jump @MainCheck
end

jump @Start



Also another one, if anyone touches CJ then they die (when if Death was to touch you), they do not even need to hit him. Type "CJDESTROYS" on your keyboard like a cheat code to activate.


Code:

{$CLEO}
0000:

:Script01
wait 0
0006: 30@ = -229906
008B: 30@ = &0(30@,1i) // (int)
0085: 31@ = 30@ // (int)
0016: 31@ /= 65536
0012: 31@ *= 65536
0062: 30@ -= 31@ // (int)
if
0039:  30@ == 0x434A  // CJ
jf @Script01
0006: 30@ = -229907
if
0038:  &0(30@,1i) == 0x44455354 // DEST
jf @Script01
0006: 30@ = -229908
if
0038:  &0(30@,1i) == 0x524F5953 // ROYS
jf @Script01
0004: &0(30@,1i) = 0x524F5900
03E5: show_text_box 'CHEAT1' 


:Script03
wait 0
0006: 30@ = -229906
008B: 30@ = &0(30@,1i) // (int)
0085: 31@ = 30@ // (int)
0016: 31@ /= 65536
0012: 31@ *= 65536
0062: 30@ -= 31@ // (int)
if
0039:  30@ == 0x434A  // CJ
jf @Script02
0006: 30@ = -229907
if
0038:  &0(30@,1i) == 0x44455354 // DEST
jf @Script02
0006: 30@ = -229908
if
0038:  &0(30@,1i) == 0x524F5953 // ROYS
jf @Script02
0004: &0(30@,1i) = 0x524F5900
03E5: show_text_box 'CHEAT8'
jump @Script01


:Script02
0A8D: 4@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 4@ += 0x4
0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0
for 5@ = 0 to 35584 step 0x100
    0A8D: 3@ = read_memory 4@ size 1 virtual_protect 0
    000A: 4@ += 0x1
    if and
    0029:  3@ >= 0x00
    001B:  0x80 > 3@
    then
        005A: 3@ += 5@ // (int)
        if and
        8118:  not actor 3@ dead
        803C:  not  $PLAYER_ACTOR == 3@ // (int)
        then
            for 31@ = 0 to 3
                if
                0A1B:  actor 3@ colliding_with_actor $PLAYER_ACTOR
              then
                    0223: set_actor 3@ health_to 0
                    break
                end
            end
        end
    end
end

jump @Script03




_________________
Some links for modding information:
• GTAModding Wiki
• Документация по моддингу GTA
• Sanny Builder (Русский)
• Sanny Builder Profile

View user profile http://gtamodding.com

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum