Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      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

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

Draw texts above actors like in SA-MP?


-ATP-
 Share

Recommended Posts

Hi,

is it posible to create texts above actors like we know it from SA-MP in Single-Player? Like here for example:

user posted image

 

Greetings, ATP

Link to comment
Share on other sites

NTAuthority

That script's world-to-screen-space code is only meant for cases where the camera is within the photo camera's viewfinding mode. Try calling the following function using the CLEO function calls (untested):

 

 

:WorldToScreenconst   TEMP_VAR_1      = [email protected]       // inCoord location   TEMP_VAR_2      = [email protected]       // outCoord location   TEMP_VAR_3      = [email protected]       // outX location   TEMP_VAR_4      = [email protected]       // outY location   IN_VAR          = 4         // in => [email protected]@ ([email protected] * 4)   OUT_VAR         = 16        // out => [email protected]@ ([email protected] * 4)   OUT_COORDS      = 28        // coords => [email protected] x, [email protected] y ([email protected] * 4)   PROC_COORDS     = 0x70CE30  // ConvertGlobalXYToScreenXYendvar   IN_VAR: Integer   OUT_VAR: Integer   TEMP_VAR_1: Integer   TEMP_VAR_2: Integer   TEMP_VAR_3: Integer   TEMP_VAR_4: Integerend0A9F: TEMP_VAR_1 = current_thread_pointerTEMP_VAR_1 += 60TEMP_VAR_2 = TEMP_VAR_1TEMP_VAR_3 = TEMP_VAR_1TEMP_VAR_4 = TEMP_VAR_1TEMP_VAR_1 += IN_VARTEMP_VAR_2 += OUT_VARTEMP_VAR_3 += OUT_COORDSTEMP_VAR_4 = TEMP_VAR_3TEMP_VAR_4 += 40AA5: call PROC_COORDS num_params 6 pop 0 TEMP_VAR_1 TEMP_VAR_2 TEMP_VAR_3 TEMP_VAR_4 1 1// now, [email protected] and [email protected] should contain screen coords for location at ([email protected], [email protected], [email protected])return

 

 

(also, I don't know it from SA-MP, I know it from the actual in-game use of that function wink.gif )

SsZgxdL.png

Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding!

Link to comment
Share on other sites

Wow... I thought 3D>2D coords was still just a distant dream. This is like, so useful for my mod(s) tounge.gif

 

Any way to get a size, rotation etc? It probably doesn't matter for me but this info is always good written down.

Link to comment
Share on other sites

NTAuthority

 

Any way to get a size, rotation etc? It probably doesn't matter for me but this info is always good written down.

That code was a bit wrong; actually [email protected] and [email protected] will contain the screen coordinates, but the screen size adjustment is not yet applied to them. You'll have to perform calculations like done on this C# code: ([email protected] and [email protected] will get 'zoom' scale, usually used in text draw scale things)

 

 

           // translate screen size           int sizeX = (int)(1 / Memory.ReadSingle(0x859520)); // can be 640.0f           int sizeY = (int)(1 / Memory.ReadSingle(0x859524)); // can be 448.0f           int fullX = Memory.ReadInt32(0xC17044);           int fullY = Memory.ReadInt32(0xC17048);           float factorX = sizeX / ((float)fullX);           float factorY = sizeY / ((float)fullY);           retval.pX *= factorX;           retval.pY *= factorY;

 

SsZgxdL.png

Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding!

Link to comment
Share on other sites

4elovek_paket

Could you write a small example? the car to withdraw any word.

Edited by 4elovek_paket
Link to comment
Share on other sites

 

That script's world-to-screen-space code is only meant for cases where the camera is within the photo camera's viewfinding mode. Try calling the following function using the CLEO function calls (untested):

 

 

:WorldToScreenconst   TEMP_VAR_1      = [email protected]       // inCoord location   TEMP_VAR_2      = [email protected]       // outCoord location   TEMP_VAR_3      = [email protected]       // outX location   TEMP_VAR_4      = [email protected]       // outY location   IN_VAR          = 4         // in => [email protected]@ ([email protected] * 4)   OUT_VAR         = 16        // out => [email protected]@ ([email protected] * 4)   OUT_COORDS      = 28        // coords => [email protected] x, [email protected] y ([email protected] * 4)   PROC_COORDS     = 0x70CE30  // ConvertGlobalXYToScreenXYendvar   IN_VAR: Integer   OUT_VAR: Integer   TEMP_VAR_1: Integer   TEMP_VAR_2: Integer   TEMP_VAR_3: Integer   TEMP_VAR_4: Integerend0A9F: TEMP_VAR_1 = current_thread_pointerTEMP_VAR_1 += 60TEMP_VAR_2 = TEMP_VAR_1TEMP_VAR_3 = TEMP_VAR_1TEMP_VAR_4 = TEMP_VAR_1TEMP_VAR_1 += IN_VARTEMP_VAR_2 += OUT_VARTEMP_VAR_3 += OUT_COORDSTEMP_VAR_4 = TEMP_VAR_3TEMP_VAR_4 += 40AA5: call PROC_COORDS num_params 6 pop 0 TEMP_VAR_1 TEMP_VAR_2 TEMP_VAR_3 TEMP_VAR_4 1 1// now, [email protected] and [email protected] should contain screen coords for location at ([email protected], [email protected], [email protected])return

 

 

(also, I don't know it from SA-MP, I know it from the actual in-game use of that function wink.gif )

Hmm, I tried to use this function, but it crashes my game. Anybody know how I have to use it correct?

Edited by -ATP-
Link to comment
Share on other sites

  • 2 months later...

Another bump but it's needed to post the problem solution. blush.gif

 

NTAuthority, every call/function params are inverted and they need to be a pointer of some addresses which store the useful value (in this case we use scm variables as reference). Here is the script:

 

{ FUNCTIONS INCLUDED:-   getScreenXYFrom3DCoords     Type: GET       Description: Get the screen 2D coords from 3D coords.-   getLocalVarOffset     Type: GET       Description: Get local var offset from thread pointer.-   getFullScreenXY     Type: GET       Description: Get screen XY from current resolution.}{$CLEO}0000: NOP03F0: enable_text_draw 1 while true wait 0  04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0  0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ [email protected] [email protected] [email protected] store_to [email protected] [email protected]  054C: use_GXT_table 'SWEET6'  0341: unknown_text_draw_flag 0  0342: enable_text_draw_centered 1  033E: set_draw_text_position [email protected] [email protected] GXT 'SWE6B34' end:getScreenXYFrom3DCoords{ Parameters:   Passed:     [email protected] - position X     [email protected] - position Y     [email protected] - position Z   Result:     [email protected] - screen X     [email protected] - screen Y Example:   0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ 2488.562 -1666.865 12.8757 store_to [email protected] [email protected] }[email protected] = 1 0A9F: [email protected] = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected] // in => [email protected]@0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 3 store_to [email protected] // out => [email protected]@0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 6 store_to [email protected] // coords => [email protected]@0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 9 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 12 store_to [email protected] 0AA5: call 0x70CE30 num_params 6 pop 6 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] 0AB1: call_scm_func @getFullScreenXY 2 coords_XY [email protected] [email protected] store_to [email protected] [email protected] 0AB2: ret 2 [email protected] [email protected] :getLocalVarOffset{ Parameters:   Passed:     [email protected] - thread pointer     [email protected] - var number   Result:     [email protected] - var value Example:   0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected] }if  [email protected] <> 0 then [email protected] *= 0x4  0A8E: [email protected] = [email protected] + 0xDC // mission flag if    [email protected] == 1  then   [email protected] += 0xA48960  else   005A: [email protected] += [email protected]    [email protected] += 0x3C  endelse [email protected] = 0 end0AB2: ret 1 [email protected] :getFullScreenXY{ Parameters:   Passed:     [email protected] - full screen X     [email protected] - full screen Y   Result:     [email protected] - screen X     [email protected] - screen Y Example:   0AB1: call_scm_func @getFullScreenXY 2 coords_XY 320.0 224.0 store_to [email protected] [email protected] }[email protected] = 640.0 // screen X0A8D: [email protected] = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] [email protected] = 448.0 // screen Y0A8D: [email protected] = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] 0AB2: ret 2 [email protected] [email protected] 

 

This script is deprecated. Find the updated version here.

Edited by Wesser

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
Share on other sites

Ooh... nice... I'll check it out later.

 

Me wonders if there's a way to do the opposite smile.gif

Link to comment
Share on other sites

  • 7 months later...

Sorry for bumping an old topic but I want to answer Deji's question:

 

Me wonders if there's a way to do the opposite smile.gif

 

{FUNCTIONS INCLUDED:-   getScreenXYFrom3DCoords     Type: GET       Description: Get screen 2D coords from world 3D coords.-   get3DCoordsFromScreenXY     Type: GET       Description: Get world 3D coords from screen 2D coords with a fixed distance.-   getFullScreenXY     Type: GET       Description: Get screen XY from current resolution.-   getLocalVarOffset    Type: GET      Description: Get local var offset from thread pointer.}{$CLEO}const WIDTH       = 640.0  HEIGHT      = 448.0  HALF_WIDTH  = 320.0  HALF_HEIGHT = 224.0 end0000: NOP03F0: enable_text_draw 1 while true wait 0  04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0  0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ [email protected] [email protected] [email protected] store_to [email protected] [email protected]  0AB1: call_scm_func @get3DCoordsFromScreenXY 3 coords_XY [email protected] [email protected] distance 1.0 store_to [email protected] [email protected] [email protected]  0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ [email protected] [email protected] [email protected] store_to [email protected] [email protected]  054C: use_GXT_table 'SWEET6'  0341: unknown_text_draw_flag 0  0342: enable_text_draw_centered 1  033E: set_draw_text_position [email protected] [email protected] GXT 'SWE6B34' end:getScreenXYFrom3DCoords{ Parameters:   Passed:     [email protected] - position X     [email protected] - position Y     [email protected] - position Z   Result:     [email protected] - screen X     [email protected] - screen Y Example:   0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ 2488.562 -1666.865 12.8757 store_to [email protected] [email protected] }0AB1: call_scm_func @getLocalVarOffset 1 var 0 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 1 var 3 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 1 var 6 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 1 var 9 store_to [email protected] 0AA5: call 0x70CE30 num_params 6 pop 6 bNearClip 0 bFarClip 0 pMultY [email protected] pMultX [email protected] pScreen [email protected] pCoords [email protected] 0AB1: call_scm_func @getFullScreenXY 2 coords_XY [email protected] [email protected] store_to [email protected] [email protected] 0AB2: ret 2 [email protected] [email protected] :get3DCoordsFromScreenXY{ Parameters:   Passed:     [email protected] - screen X     [email protected] - screen Y     [email protected] - distance   Result:     [email protected] - position X     [email protected] - position Y     [email protected] - position Z Example:   0AB1: call_scm_func @get3DCoordsFromScreenXY 3 coords_XY 320.0 224.0 distance 1.0 store_to [email protected] [email protected] [email protected] }0A8D: [email protected] = read_memory 0x8D5038 size 4 virtual_protect 0 // field of [email protected] *= 0.5 02F6: [email protected] = sine [email protected] 02F7: [email protected] = cosine [email protected] 0073: [email protected] /= [email protected] [email protected] = 1.0 [email protected] /= HALF_WIDTH // half screen X0063: [email protected] -= [email protected] 006B: [email protected] *= [email protected] [email protected] = 1.0 [email protected] /= HALF_HEIGHT // half screen Y0063: [email protected] -= [email protected] 006B: [email protected] *= [email protected] 0A8D: [email protected] = read_memory 0xC3EFA4 size 4 virtual_protect 0 // screen aspect ratio0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] 006B: [email protected] *= [email protected] 0087: [email protected] = [email protected] 0087: [email protected] = [email protected] 0087: [email protected] = [email protected] 0A8D: [email protected] = read_memory 0xB6F03C size 4 virtual_protect 0 // camera matrix0AB1: call_scm_func @getLocalVarOffset 1 var 9 store_to [email protected] 0AA5: call 0x59C790 num_params 3 pop 3 pOffsets [email protected] pMatrix [email protected] pResult [email protected] // [email protected] += 0x30 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // camera X [email protected] += 0x4 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // camera Y [email protected] += 0x4 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // camera Z position005B: [email protected] += [email protected] 005B: [email protected] += [email protected] 005B: [email protected] += [email protected] 0AB2: ret 3 [email protected] [email protected] [email protected] :getFullScreenXY{ Parameters:   Passed:     [email protected] - full screen X     [email protected] - full screen Y   Result:     [email protected] - screen X     [email protected] - screen Y Example:   0AB1: call_scm_func @getFullScreenXY 2 coords_XY 320.0 224.0 store_to [email protected] [email protected] }[email protected] = WIDTH // screen X0A8D: [email protected] = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] [email protected] = HEIGHT // screen Y0A8D: [email protected] = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] 0AB2: ret 2 [email protected] [email protected] :getLocalVarOffset{ Parameters:   Passed:     [email protected] - thread pointer (offset)   Result:     [email protected] - var pointer (offset) Example:   0AB1: call_scm_func @getLocalVarOffset 1 var 0 store_to [email protected] }0A9F: [email protected] = [email protected] *= 0x4 0A8E: [email protected] = [email protected] + 0xDC // mission flagif  [email protected] == 1 then [email protected] += 0xA48960 else 005A: [email protected] += [email protected]  [email protected] += 0x3C end0AB2: ret 1 [email protected] 

 

This script is deprecated. Find the updated version here.

Edited by Wesser

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
Share on other sites

monocle.gif

 

mercie_blink.gif

 

facedesk.gif

 

Says enough tounge.gif

 

 

Quite a nasty piece of work you managed over there. I'm impressed.
I knew that guy was almighty, just didn't get he meant you.

 

Thanks a lot, the script looks marvelous. icon14.gif

 

cookie.gif

Link to comment
Share on other sites

Pure awesoness, good work on function calls.

 

Are you half-Russian or what? tounge2.gif

Link to comment
Share on other sites

Thanks. I'm glad for your appreciations! icon14.gif

 

Quite a nasty piece of work you managed over there. I'm impressed.

I knew that guy was almighty, just didn't get he meant you.

Thanks a lot! Great representation!

 

Are you half-Russian or what? tounge2.gif

Maybe, but I'm just the only italian who makes such "difficult" (depending on the knowledges of who interprets the script) modifications. tounge2.gif

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
Share on other sites

Script doesn't work for me. angry.gif

 

April Fools! Awesome work Wesser! You never cease to amaze me. smile.gif

23088_s.gif

Link to comment
Share on other sites

Ah, so now I can have the onscreen 3D interactivity I always dreamed of smile.gif

 

Thanks for all the work, Wesser.

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.