Quantcast

Jump to content

» «
Photo

[SA] Adding a bar to the HUD

12 replies to this topic
Danikov
  • Danikov

    The Fake Russian

  • Members
  • Joined: 27 Aug 2009
  • Israel

#1

Posted 03 January 2014 - 11:59 AM

I am willing to add a bar into the HUD that depends on an integer/numeral value,been searching a few times,found a few script examples,but these examples were for adding a bar for health.

If anyone could me out with this,that'll be greatly appreciated.

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#2

Posted 03 January 2014 - 12:14 PM Edited by _DK, 03 January 2014 - 12:14 PM.

For plugins/direct drawing:
0x728640 CSprite2d::DrawBarChart(float x, float y, unsigned short width, unsigned char height, float progress, signed char progressDelta, unsigned char drawPercentage, unsigned char drawBorder, CRGBA color, CRGBA deltaColor)
For CLEO scripts:
038E: draw_box_position 320.0 224.0 size 640.0 448.0 RGBA 0 0 0 255
Draw 3 boxes with this opcode:
-black background;
-percentage line background;
-percentage line.
  • Danikov and Sidoarjo_Modder like this

Danikov
  • Danikov

    The Fake Russian

  • Members
  • Joined: 27 Aug 2009
  • Israel

#3

Posted 03 January 2014 - 12:21 PM

For plugins/direct drawing:

0x728640 CSprite2d::DrawBarChart(float x, float y, unsigned short width, unsigned char height, float progress, signed char progressDelta, unsigned char drawPercentage, unsigned char drawBorder, CRGBA color, CRGBA deltaColor)
For CLEO scripts:
038E: draw_box_position 320.0 224.0 size 640.0 448.0 RGBA 0 0 0 255
Draw 3 boxes with this opcode:
-black background;
-percentage line background;
-percentage line.

Thank you very much.

madleg
  • madleg

    Player Hater

  • Members
  • Joined: 01 Jan 2014
  • Russia

#4

Posted 12 January 2014 - 07:27 PM

0x728640

can you show some working example for this call pls? i did, but in result i received nothing (without crash)


DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#5

Posted 13 January 2014 - 02:56 PM Edited by _DK, 13 January 2014 - 02:57 PM.

#define DrawBarChart(x, y, width, height, progress, progressAdd, drawPercentage, \
    drawBlackBorder, color, addColor) ((void (__cdecl *)(float, float, unsigned short,\
    unsigned char, float, signed char, unsigned char, unsigned char, int, int))0x728640)\
    (x, y, width, height, progress, progressAdd, drawPercentage, drawBlackBorder, color,\
    addColor);

void Draw()
{
    DrawBarChart(300.0, 100.0, 300, 50, 60.0, 0, false, true, 0xFF0000FF, 0);
}

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#6

Posted 13 January 2014 - 03:47 PM

    DrawBarChart(300.0, 100.0, 300, 50, 60.0, 0, false, true, 0xFF0000FF, 0);

 

how can i use it in Cleo?

like this?

0AA5: call_function 0x728640 num_params 10 pop 10 0 0xFF0000FF 1 0 0 60.0 50 300 100.0 300.0

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#7

Posted 13 January 2014 - 04:01 PM

You can't use this with CLEO.
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#8

Posted 13 January 2014 - 04:05 PM

: (

can't ? really? : ( (

you sure? but i thought that every game funcs can be used via CLEO.

thank you for bring me out from this mistake.


Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#9

Posted 13 January 2014 - 06:43 PM

Because scripts aren't processed each frame, therefore you are unable to draw or render stuff directly with any internal function.
  • MasterHK likes this

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#10

Posted 13 January 2014 - 06:54 PM

You can check "SCM Direct Drawing" link in my sig, but I'd recommend to use it only for testing purposes.
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#11

Posted 13 January 2014 - 07:55 PM

this is a script that i've written for that purpose:

{$CLEO}
0000:
repeat
    wait 0
until player.Defined($PLAYER_CHAR)
while true
    repeat
        wait 0
    until 0ADC: "DiRDraw"
    while true
        wait 0
        if
            not Key.0AB0(SPACE)
        then
            0AB1: call @DirectRender 2 from @barChart to @end_barChart
        else
            break    
        end
    end
    0ACA: "SpacEd!"
end

:barChart
0AA5: call_function 0x728640 num_params 10 pop 10 0 0xFF0000FF 1 0 0 60.0 50 300 100.0 300.0
:end_barChart

:directRender
0A8D: 2@ = read_memory 0x884740 size 4 virtual_protect 0
if
    2@ <> 0x40404040
then
    0A9F: 3@ = current_thread_pointer
    0AA5: call 2@ num_params 3 pop 3 _end 1@ _start 0@ _script 3@
end
0AB2: ret 0

but doesn't work. can u help me that why?


DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#12

Posted 14 January 2014 - 01:52 AM

Have no idea. Can you test it with fully clean SA?
  • MasterHK likes this

MasterHK
  • MasterHK

    کیان حامی‏

  • Members
  • Joined: 20 Mar 2013
  • Iran

#13

Posted 14 January 2014 - 03:00 AM Edited by MasterHK, 15 January 2014 - 07:23 AM.

tested and...

 

Worked!

 

Thank you veryE9999999999999 Much!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users