Jump to content

Creating a Crosshair or Dot in the middle of the screen?


Recommended Posts

you could create a transparent window with a gdiplus graphic in it :P

cheers

Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Link to comment
Share on other sites

You could also simply create a gif file with a crosshair and then load it in a transparent GUI:

Example:

#include <WindowsConstants.au3>

$x = @DesktopWidth/2 - 68/2
$y = @DesktopHeight/2 - 68/2

GUICreate("", 68, 68, $x, $y, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
GUICtrlCreatePic("crosshair.gif",0,0,68,68)
GUISetState()

While 1
    Sleep(25)
WEnd

Regards

EDIT: added a gif file.

post-24573-1217277480_thumb.gif

Edited by newbiescripter
Link to comment
Share on other sites

Call of Duty 4 has a crosshair unless you are playing Hardcore mode. You would have to suck pretty hard at this game to need this.

Hardcore mode = less bullets to kill someone.

Link to comment
Share on other sites

Call of Duty 4 has a crosshair unless you are playing Hardcore mode. You would have to suck pretty hard at this game to need this.

Hardcore mode = less bullets to kill someone.

Lol, tell that to Dethredic, I don't even play COD4. Lmao.

Link to comment
Share on other sites

Lol, tell that to Dethredic, I don't even play COD4. Lmao.

Dethredic, "You would have to suck pretty hard at this game to need this."

But seriously, this game is easy. The only difficult part of Hardcore is not knowing how much ammo you have or where your teammates are. Killing people is easier than normal mode AND there is little grenade spam.

Link to comment
Share on other sites

The only time you would need a crosshair is when you are shooting from the hip, and the only time you should be shooting like that is when you are sprinting. Damage is reduced a lot when you aren't zoomed in.

Link to comment
Share on other sites

Yeah, but if you do that, you actually feel yourself becoming lamer. If you run the program, you can mask the (equally) lame feeling it creates by exclaiming, "OH GOSH! I SO SMART! I PROGRAM DOTZ!"

I've never played Call of Duty 4, but if you can't beat it without help from a program or pen, and you beat it with one, then you never truly beat it at all. Now you're just tacking cheater onto your underachiever record. :P

Link to comment
Share on other sites

You could also simply create a gif file with a crosshair and then load it in a transparent GUI:

Example:

#include <WindowsConstants.au3>

$x = @DesktopWidth/2 - 68/2
$y = @DesktopHeight/2 - 68/2

GUICreate("", 68, 68, $x, $y, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))
GUICtrlCreatePic("crosshair.gif",0,0,68,68)
GUISetState()

While 1
    Sleep(25)
WEnd

Regards

EDIT: added a gif file.

Err, i tried that in Soldier Front (SF) but it did not appear in game , why's that so ?
Link to comment
Share on other sites

Because like most FPS games, they have the "on top" attribute set as well and will display over the top of your gif. I believe the only truly effective method is to inject your "application" into memory. Don't ask me how, I've never done it, but there are several team chat programs that do it (they display stuff as an overlay on your game screen). Maybe finding out how they do it would help you in your dot quest :P

Link to comment
Share on other sites

Because like most FPS games, they have the "on top" attribute set as well and will display over the top of your gif. I believe the only truly effective method is to inject your "application" into memory. Don't ask me how, I've never done it, but there are several team chat programs that do it (they display stuff as an overlay on your game screen). Maybe finding out how they do it would help you in your dot quest :P

How do i do that ..

P.S. : If you dont know , im not trying to ask you , trying to ask some others..

Link to comment
Share on other sites

time ago a made my own,

#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Include <GDIPlus.au3>




mycross(500,400,20)



func mycross($start_x,$start_y,$mylenght)
    _GDIPlus_Startup ()
    $hDC = _WinAPI_GetWindowDC(0)

    $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC)
    $Color = 0xFF000000
    $hPen = _GDIPlus_PenCreate($Color,2)


    For $y = 0 to 3000

            _GDIPlus_GraphicsDrawLine($hGraphic, $start_x - $mylenght, $start_y, $start_x - 5, $start_y, $hPen);orizzontale dx
            _GDIPlus_GraphicsDrawLine($hGraphic, $start_x  + $mylenght , $start_y, $start_x + 5, $start_y, $hPen);orizzontale sx
            _GDIPlus_GraphicsDrawLine($hGraphic, $start_x, $start_y - $mylenght, $start_x, $start_y - 5, $hPen);verticale up
            _GDIPlus_GraphicsDrawLine($hGraphic, $start_x, $start_y + $mylenght, $start_x, $start_y + 5, $hPen);verticale down
            $Color += Hex(2)
            _GDIPlus_PenSetColor($hPen, $Color)
    Next


    _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN)
    _WinAPI_ReleaseDC(0, $hDC)
    _GDIPlus_Shutdown()

EndFunc

bye,

m.

Link to comment
Share on other sites

Hi!

So ... I had the same idea and tried to make it like that:

$dll = Dllopen("C:\Programme\Valve\gpcomms.dll")

$posx = cs()/2-50 ;
$posy = cs()/2+50;



While 1   
 NewPicture("C:\Programme\Valve\fadenkreuz.tga",1,$posx,$posy)
WEnd

Func cs()
Opt("WinTitleMatchMode", 3)
Return WinGetHandle("Counter-Strike") 
If @error then exit
EndFunc



Func NewPicture($PathToFile="", $ShowIt=0, $PosX=0, $PosY=0)
    $return = DllCall($dll,"Int","GPPIC_LoadNewPicture","Str",$PathToFile)
    If @error > 0 Or $return = 0 Then
        SetError(1)
        Return(-1)
    EndIf
    $return = DllCall($dll, "Int", "GPPIC_ShowPicturePos", "Str", $ShowIt, "ushort", $PosX, "ushort", $PosY)
    If @error > 0 Or $return = 0 Then
        SetError(1)
        Return(-1)
    EndIf
EndFunc

... Doesn't work ... but I think it was a tring'!

Lenny

Link to comment
Share on other sites

time ago a made my own,

bye,

m.

Here is your script changed to use GDI only (instead of GDI+)

#include <WindowsConstants.au3>
#include <WinAPI.au3>

mycross(500,400,20)

func mycross($start_x,$start_y,$mylenght)
    $hDC = _WinAPI_GetWindowDC(0)
    $Color = 0xFF
 $hPen = DLLCall("gdi32.dll","int","CreatePen","int",0,"int",2,"int",$Color)
 $hPen = $hPen[0]
 $obj_orig = _WinAPI_SelectObject($hDC, $hPen)
 
 _GDI_DrawLine($hDC, $start_x - $mylenght, $start_y, $start_x - 5, $start_y);orizzontale dx
 _GDI_DrawLine($hDC, $start_x  + $mylenght , $start_y, $start_x + 5, $start_y);orizzontale sx
 _GDI_DrawLine($hDC, $start_x, $start_y - $mylenght, $start_x, $start_y - 5);verticale up
 _GDI_DrawLine($hDC, $start_x, $start_y + $mylenght, $start_x, $start_y + 5);verticale down

 Sleep(3000) ; show red cross for 3s

    _WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE+$RDW_ALLCHILDREN)
 _WinAPI_SelectObject($hDC, $obj_orig[0])
 _WinAPI_DeleteObject($hPen)
    _WinAPI_ReleaseDC(0, $hDC)
EndFunc

Func _GDI_DrawLine($DC, $x1, $y1, $x2, $y2)
 DLLCall("gdi32.dll","int","MoveToEx","int",$DC,"int",$x1,"int",$y1,"int",0)
 DLLCall("gdi32.dll","int","LineTo","int",$DC,"int",$x2,"int",$y2)
EndFunc
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...