IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Check if player is wearing armour

 
thrndm  
Posted: Sunday, Mar 18 2012, 12:47
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Mar 5, 2010

XXXXX



Hello there. I'm trying to check if player is wearing armour and sitting in vehicle. There is no 04DD opcode in III so I'm forced to use memory-related functions to get current armour value. Temporary test code below is supposed to show tiny weapon icon when player is on foot and quickly switch between tiny and large-sized weapon icon when player wears armour and uses vehicle. Instead it crashes my game as soon as I enter the car. I got feeling that something is wrong with read_memory related part of code but I'm unable to find an error here.
I hope someone could help me on this. Thanks in advance.
CODE
{$CLEO}  
0000:  

:CARH0
wait 0 ms
if
0256:player $2 defined
jf @CARH0
035E:set_player $2 armour_to 100

:CARH1
wait 0 ms        
05DF:write_memory 0x5FDBB0 size 4 value 16.0 virtual_protect 0
if
00E0:player $2 driving
jf @CARH1

:CARH2
wait 0
05E6:1@ = actor $2 struct
1@ += 0x2C0
1@ += 0x4
05E0:1@ = read_memory 1@ size 4 virtual_protect 0
008C:1@ = float_to_integer 1@
if
1@ > 0
jf @CARH2

:CARNO
wait 0 ms                    
05DF:write_memory 0x5FDBB0 size 4 value 128.0 virtual_protect 0
jump @CARH1


This post has been edited by thrndm on Sunday, Mar 18 2012, 16:47
PM
  Top
 

 
Ashwin the new boy  
Posted: Sunday, Mar 18 2012, 13:01
Quote Post


I am The Most Confused Person
Group Icon
Group: Members
Joined: Nov 14, 2010

ia.gif

XXXXX



the problem is
CODE

05E6:1@ = actor $2 struct

actor is $3
$2 is used for Player_CHAR
and
another thing is '05E6' also crash the game, (for me)

also start label after new line, it makes easy to read,

use 0x2C4
instead of
1@ += 0x2C0
1@ += 0x4

and i am not sure your mem add,

This post has been edited by Ashwin the new boy on Sunday, Mar 18 2012, 13:06
Users WebsitePM
  Top
 

 
Link2012  
Posted: Sunday, Mar 18 2012, 13:15
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



CODE
05E6:1@ = actor $2 struct

$2 isn't a actor, is a player, use $3 for player actor handle.

EDIT: Sorry, I posted too late, ashwin already posted bored.gif
PMMSN
  Top
 

 
Ashwin the new boy  
Posted: Sunday, Mar 18 2012, 13:22
Quote Post


I am The Most Confused Person
Group Icon
Group: Members
Joined: Nov 14, 2010

ia.gif

XXXXX



i want to say something for you LINK,
* you were not here when i post this reply,
* you have not edited you post you just add that last sentence during reply,
* i think you are just increasing your POST,
sorry if i am wrong,
Users WebsitePM
  Top
 

 
Link2012  
Posted: Sunday, Mar 18 2012, 13:31
Quote Post


Wut?
Group Icon
Group: Members
Joined: Jan 30, 2011

ba.gif

XXXXX



QUOTE
* you were not here when i post this reply,

I was logged as anonymous.

QUOTE
* you have not edited you post you just add that last sentence during reply,

Wrong, If you say it because the post doesn't contain a "This post has been edited by...", that is because I edited in the same instant that I posted, So this msg doesn't appears

QUOTE
* i think you are just increasing your POST,

If I'm interested in increase my post count I was flooding in other forum sections, but I'm posting just here in coding section (and sometimes only).

Don't acknowledge people thus dozingoff.gif
PMMSN
  Top
 

 
thrndm  
Posted: Sunday, Mar 18 2012, 16:46
Quote Post


Player Hater
Group Icon
Group: Members
Joined: Mar 5, 2010

XXXXX



Alright, looks like this one works. ..Thanks to ThirteenAG.
CODE
{$CLEO}  
0000:  

:CARH0
wait 0 ms
if
0256:player $2 defined
jf @CARH0
035E:set_player $2 armour_to 100

:CARH1
wait 0 ms        
05DF:write_memory 0x5FDBB0 size 4 value 16.0 virtual_protect 0
if
00E0:player $2 driving
jf @CARH1

:CARH2
wait 0
05E6:1@ = actor $SCRIPT_CONTROLLED_PLAYER struct
000A:1@ += 704
000A:1@ += 4
05E0:1@ = read_memory 12@ size 4 virtual_protect 0
008C:1@ = float_to_integer 12@
if
1@ > 0
jf @CARH2

:CARNO
wait 0 ms                    
05DF:write_memory 0x5FDBB0 size 4 value 128.0 virtual_protect 0
jump @CARH1

Thread may be closed now I guess, thanks to everyone.

This post has been edited by thrndm on Sunday, Mar 18 2012, 16:49
PM
  Top
 

 

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

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG