Quantcast

Jump to content

» «
Photo

Sniper cross hairs

23 replies to this topic
Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#1

Posted 17 April 2012 - 10:19 AM

I need to know how to put sniper crosshair on the other weapons in VC - particulary mp5lng. I don't want that all weapons have that crosshair. I need to know how to do that on the single weapon without changing crosshairs of the other weapons. So is it possible to do that with coding and if it is - how?

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#2

Posted 17 April 2012 - 11:58 AM

There can be many ways of doing that,
For example :>
open hud.txd & Make the crosshair texture of the weapon transparent,
now make a script that draw a texture of crosshair on screen for all weapon, but not that one,
i have used this way in VCU to give Different crosshair to each weapon!
otherwise go find a mem add for it like i have found for Background & Cursor!

DK22Pac
  • DK22Pac

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]

#3

Posted 17 April 2012 - 01:46 PM

Theres a procedure which draws crosshair. Playing with it, you can do anything you want.

Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#4

Posted 18 April 2012 - 11:40 AM

QUOTE
otherwise go find a mem add for it like i have found for Background & Cursor!

But what values should I search?

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#5

Posted 18 April 2012 - 01:30 PM

Search for Texture name in memory View!

Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#6

Posted 18 April 2012 - 02:49 PM

I found something in memory view named "sitesniper" and the address which contain that is 6977B8 so I build this:
CODE
{$CLEO .cs}
thread 'SITE'

:CHECK
wait 0
if and
00E1: key_pressed 0 6  
02D8: actor $PLAYER_ACTOR current_weapon == 25
else_jump @CHECK
05E0: 0@ = read_memory 0x6977B8 size 4 virtual_protect 0  
jump @CHECK
05DC: end_custom_thread
Nothing is happening - why? Is that the wrong memory address? Or maybe I should add "write_memory" opcode and write the value that cheat engine gave me for this address?

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#7

Posted 18 April 2012 - 03:32 PM Edited by Ashwin the new boy, 18 April 2012 - 03:34 PM.

Nothing is happening because,
you made a script which read & stores 4byte value of ADD 0x6977B8 to 0@,
you didn't told anything to do, only read,
another thing is, are you sure that the Add you have found is correct & stable,
before making a script for it, Test it on CE itself,
like rename it to other texture name & check if it is Showing that texture instead of Default or not,

A off Topic Question
Are you trying to make a Mod(TC) for VC to make it like CounterStrike ?

Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#8

Posted 18 April 2012 - 05:45 PM Edited by JACK JONES, 18 April 2012 - 05:52 PM.

I tried with a first method:
CODE
{$CLEO .cs}
thread 'SITE'

:START
0390: load_txd_dictionary 'HUD'
038F: load_texture "SITESNIPER" as 1 // Load dictionary with 0390 first

:CHECK
wait 0
if and
00E1: key_pressed 0 6  
02D8: actor $PLAYER_ACTOR current_weapon == 25
else_jump @CHECK
038D: draw_texture 1 position 0.0 0.0 size 10.0 10.0 RGBA 128 128 128 128
jump @CHECK
05DC: end_custom_thread
but when I clicked start new game - loading bar stuck at 95%. I never worked with texture opcodes before so I know this looks bad (I'm only testing the scrypt).
QUOTE
Are you trying to make a Mod(TC) for VC to make it like CounterStrike ?

No I'm only curious how to change crosshairs. Why - is there's some mod for VC?

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None
  • Contribution Award [Mods]

#9

Posted 18 April 2012 - 08:05 PM

03F0 could help, since as far as SA goes, without it, the texture that is drawn is displayed permanently (and since you're looping it, you get an overload of drawn textures).

DK22Pac
  • DK22Pac

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]

#10

Posted 18 April 2012 - 08:18 PM

I haven't much time, and actually, I haven't VC atm. But I looked to vice's idb, and found the place where it selects site texture. So I could help you later, if someone else wouldnt do it.

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#11

Posted 19 April 2012 - 10:43 AM

@JJ
there are some problem in your script,

* In VC, string must be in ' ' instead of " "
* texture name must not exceed 7 letter,
*
CODE
03F0: enable_text_draw 1

put this opcode after Loading texture, as you are using LOOP

* drawing texture at position 0.0 & 0.0 means, at the TOP LEFT,

* use RGBA 255 instead of 128, it ill Look better
------------------
to create the texture in center,
read & store the current Resolution of game to a variable,
divide it by 2.0 & use it as Position p,

Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#12

Posted 19 April 2012 - 03:52 PM Edited by JACK JONES, 19 April 2012 - 03:57 PM.

I've fixed some errors but the same problem remains:
CODE
{$CLEO .cs}
thread 'SITE'

:START
0390: load_txd_dictionary 'HUD'
038F: load_texture 'SITESNI' as 1
03F0: enable_text_draw 1

:CHECK
wait 0
if and
00E1: key_pressed 0 6  
02D8: actor $PLAYER_ACTOR current_weapon == 25
else_jump @CHECK
038D: draw_texture 1 position 320.0 240.0 size 10.0 10.0 RGBA 255 255 255 255
jump @CHECK
05DC: end_custom_thread
- loading bar is still stucking at 95% when I click on the start new game.

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#13

Posted 20 April 2012 - 09:18 AM

put a wait 5000 at starting to ensure that game crashed by this script,
also no need to load 'hud'
& double check your Texture,
compress it & try to open it with any other TXD tool,

Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#14

Posted 20 April 2012 - 10:26 AM Edited by JACK JONES, 20 April 2012 - 10:30 AM.

QUOTE
put a wait 5000 at starting to ensure that game crashed by this script,
I already did that - the scrypt is definetly causing a problem - the game just stuck (without crashing) and then I have no choice but to kill gta vc.exe proces.
QUOTE
also no need to load 'hud'
I tried that but the game crashes when I load a texture without loading a HUD txd_dictionary first
QUOTE
& double check your Texture,
compress it & try to open it with any other TXD tool,
I already compressed and saved all textures in the hud. What do you mean by "double check your Texture"? It's all original files if that's what you're asking.
And the opcode for loading a txd_dictionary is probably stucking the game - I learned from the opcode database that it's never been used in VC or GTAIII. Have you ever tested it for VC?

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#15

Posted 20 April 2012 - 10:50 AM

Hm...
download & edit some VC mods that creates texture,

PCS
Transformer
V. Fuel
V. Damage meter

QUOTE
Have you ever tested it for VC?

lol.gif

Silent
  • Silent

    Altering R* Vision™ since 2008

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#16

Posted 20 April 2012 - 02:33 PM

0390 needs the TXD file to be placed in txd folder. So, you can't draw stuff from hud.txd in SCM at all using traditional methods.

Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#17

Posted 20 April 2012 - 03:07 PM

QUOTE
0390 needs the TXD file to be placed in txd folder. So, you can't draw stuff from hud.txd in SCM at all using traditional methods.
Is there some easy counter-traditional method?

Silent
  • Silent

    Altering R* Vision™ since 2008

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#18

Posted 20 April 2012 - 03:33 PM

No.

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#19

Posted 21 April 2012 - 06:33 AM

CODE

{$CLEO .cs}

//-------------CLEO---------------
thread 'ASHWIN'

// Reading the Game Resolution //
05E0: 1@ = read_memory 0xA0FD04 size 4 virtual_protect 0
05E0: 2@ = read_memory 0xA0FD08 size 4 virtual_protect 0

// Converting it to float for 038D //
0093: 1@ = integer 1@ to_float
0093: 2@ = integer 2@ to_float

// using these for Size //
0087: 3@ = 1@
0087: 4@ = 2@

// % for Pos //
1@ /= 100.0
2@ /= 100.0
1@ *= 53.0         //<--- Width
2@ *= 40.0         //<--- Height

// % for Size //
3@ /= 100.0
4@ /= 100.0
3@ *= 4.0         //<--- Width
4@ *= 4.0         //<--- Height

// Loading Texture, without USING 0390 //
038F: load_texture 'sunyard' as 5     //<-- it is already present in HUD,
03F0: enable_text_draw 1

:0
wait 0
if  and
00E1:   key_pressed 0 6
02D7:   player $2 currentweapon == 22
jf @0
038D: draw_texture 5 position 1@ 2@ size 3@ 4@ RGBA 255 255 255 100
jump @0


I have tried that it will work with every resolution

@JJ
pls don't mind but i think you are using 640 x 480, fix it!
Good Luck.

Jack
  • Jack

    QRF

  • Feroci
  • Joined: 06 Dec 2011
  • Serbia

#20

Posted 21 April 2012 - 09:29 AM

CODE
{$CLEO .cs}
thread 'ASHWIN'

:START
05E0: 1@ = read_memory 0xA0FD04 size 4 virtual_protect 0
05E0: 2@ = read_memory 0xA0FD08 size 4 virtual_protect 0
0093: 1@ = integer 1@ to_float
0093: 2@ = integer 2@ to_float
0087: 3@ = 1@
0087: 4@ = 2@
0017: 1@ /= 100.0
0017: 2@ /= 100.0
0013: 1@ *= 53.0 // floating-point values        
0013: 2@ *= 40.0 // floating-point values        
0017: 3@ /= 100.0
0017: 4@ /= 100.0
0013: 3@ *= 4.0 // floating-point values      
0013: 4@ *= 4.0 // floating-point values      
038F: load_texture 'sunyard' as 5    
03F0: enable_text_draw 1

:0
wait 0
if  and
00E1:   key_pressed 0 6
02D7: player $player_char currentweapon == 22
else_jump @0
038D: draw_texture 5 position 1@ 2@ size 3@ 4@ RGBA 255 255 255 100
jump @0
05DC: end_custom_thread
Game crashing at 95% of loading bar caused by this opcode:
CODE
038F: load_texture 'sunyard' as 5

It's important to say that I've completly reinstaled Vice City, CLEO for VC and Sanny Builder. Then I've puted that last CLEO thread in CLEO folder and compiled it with SB. I'm sure that the opcode 038F causing a crash because when I expeled it the crashing stops (except when the code reaches 038D which is not a surprise because the texture isn't loaded with a 038F which I expeled). Also my VC setup file is very old (2004) - could that be a problem? And the screen resolution is 640*480.

DK22Pac
  • DK22Pac

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]

#21

Posted 21 April 2012 - 09:33 AM

QUOTE (JACK JONES @ Friday, Apr 20 2012, 18:37)
Is there some easy counter-traditional method?

CODE
while true
   wait 0
   05E0: 0@ = read_memory 0x9B5F04 size 4 virtual_protect 0
   05DF: write_memory 0x8117E8 size 4 value 0@ virtual_protect 0
   03F0: enable_text_draw 1
   038D: draw_texture 1 position 200.0 200.0 size 400.0 400.0 RGBA 255 255 255 255
end

But you can't draw crosshair with this, cause it must be drawed 4 times with different position and angle.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None
  • Contribution Award [Mods]

#22

Posted 21 April 2012 - 11:40 AM

Wouldn't the angled draw_texture opcode suffice?

Silent
  • Silent

    Altering R* Vision™ since 2008

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#23

Posted 21 April 2012 - 12:15 PM

No such opcode in VC.

Ashwin.Star
  • Ashwin.Star

    i'll be back...

  • Members
  • Joined: 14 Nov 2010
  • India

#24

Posted 21 April 2012 - 12:28 PM

Glad i had it,
using of another rotated texture is the only way to do that in VC,




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users