Results 1 to 8 of 8
  1. #1
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    North of Hell, South of Heaven
    Posts
    6,067
    Reputation
    323
    Thanks
    3,323
    My Mood
    Doh

    1 more thing i need help with lol

    found this on forums awhile ago and wanted to use it, it was that circle around the crosshair for a custom crosshair...i added it to my menu, went to test, got to it, and it crashed me...there somethin wrong with the coding?

    Code:
    ID3DXLine *pLine;
    #define PI 3.14159265
    int iCenterX = GetSystemMetrics( 0 ) / 2;
    int iCenterY = GetSystemMetrics( 1 ) / 2;
    
    void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color)
    {
        D3DXVECTOR2 Line[128];
        float Step = PI * 2.0 / numSides;
        int Count = 0;
        for (float a=0; a < PI*2.0; a += Step)
        {
            float X1 = radius * cos(a) + X;
            float Y1 = radius * sin(a) + Y;
            float X2 = radius * cos(a+Step) + X;
            float Y2 = radius * sin(a+Step) + Y;
            Line[Count].x = X1;
            Line[Count].y = Y1;
            Line[Count+1].x = X2;
            Line[Count+1].y = Y2;
            Count += 2;
        }
        pLine->Begin();
        pLine->Draw(Line,Count,Color);
        pLine->End();
    }
    
    if( CH_xhair ==4 ){
            DrawCircle(iCenterX,iCenterY,10,50,D3DCOLOR_ARGB( 255, 255 , 0 ,0));
            D3DCOLOR xcolor = D3DCOLOR_ARGB( 255, 255, 0, 0 );
                                 
            int size = 15, strong = 1;
            int iCenterX = GetSystemMetrics( 0 ) / 2;
            int iCenterY = GetSystemMetrics( 1 ) / 2;
            if( iCenterX < 20 && iCenterY < 20 )
            {
                iCenterX = ( GetSystemMetrics( 0 ) / 2 );
                iCenterY = ( GetSystemMetrics( 1 ) / 2 );
            }
            D3DRECT rec2 = { iCenterX- size, iCenterY, iCenterX+ size, iCenterY+ strong};
            D3DRECT rec3 = { iCenterX, iCenterY- size, iCenterX+ strong,iCenterY+ size};
            pDevice->Clear(1, &rec2, D3DCLEAR_TARGET, xcolor, 0,  0);
            pDevice->Clear(1, &rec3, D3DCLEAR_TARGET, xcolor, 0,  0);
        }
    help will be appreciated. i really wanna use this cross hair

    and i'd post credits since i'm posting the code, but i don't remember who posted it

    commando: You're probably the best non-coder coder I know LOL


  2. #2
    ★Rusty's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    My House/CShell Codes: C++
    Posts
    111
    Reputation
    14
    Thanks
    297
    My Mood
    Psychedelic
    Code:
    ID3DXLine *pLine;
    #define PI 3.14159265
    int iCenterX = GetSystemMetrics( 0 ) / 2;
    int iCenterY = GetSystemMetrics( 1 ) / 2;
    
    void DrawCircle(int X, int Y, int radius, int numSides, DWORD Color)
    {
        D3DXVECTOR2 Line[128];
        float Step = PI * 2.0 / numSides;
        int Count = 0;
        for (float a=0; a < PI*2.0; a += Step)
        {
            float X1 = radius * cos(a) + X;
            float Y1 = radius * sin(a) + Y;
            float X2 = radius * cos(a+Step) + X;
            float Y2 = radius * sin(a+Step) + Y;
            Line[Count].x = X1;
            Line[Count].y = Y1;
            Line[Count+1].x = X2;
            Line[Count+1].y = Y2;
            Count += 2;
        }
        pLine->Begin();
        pLine->Draw(Line,Count,Color);
        pLine->End();
    }
    That bit is right. then to draw it do this
    Code:
    DrawCircle(iCenterX,iCenterY,8,8,Red);

  3. #3
    -ExileD-'s Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    http://mpgh.net Posts: 25,987
    Posts
    552
    Reputation
    32
    Thanks
    794
    My Mood
    Lurking
    Lmfao, that is such a fail code.
    I dont even know where to start.

  4. #4
    klofee's Avatar
    Join Date
    Jan 2009
    Gender
    male
    Posts
    36
    Reputation
    10
    Thanks
    2
    Call it from RenderFrame.
    Code:
    void cBase::RenderFrame(LPDIRECT3DDEVICE9 pDevice){
    if( crosshair > 0 ){
    // DrawCrosshair.
    }
    }

  5. #5
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    North of Hell, South of Heaven
    Posts
    6,067
    Reputation
    323
    Thanks
    3,323
    My Mood
    Doh
    it was in my renderframe

    anyway, i just took it out, no matter what i did, it crashed my game, i even had some help from ac1d burn and it crashed me o_O

    doesn't help that nothing else in the menu works anyway xD

    commando: You're probably the best non-coder coder I know LOL


  6. #6
    markoj's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    s
    Posts
    1,067
    Reputation
    60
    Thanks
    407
    My Mood
    Bored
    Quote Originally Posted by supercarz1991 View Post
    doesn't help that nothing else in the menu works anyway xD
    Then you should work on your sig
    Dont ban me

  7. #7
    supercarz1991's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    North of Hell, South of Heaven
    Posts
    6,067
    Reputation
    323
    Thanks
    3,323
    My Mood
    Doh
    Quote Originally Posted by markoj View Post
    Then you should work on your sig
    it should work, it doesn't even work straight from an unedited source. its ac1ds source

    commando: You're probably the best non-coder coder I know LOL


  8. #8
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,406
    Reputation
    157
    Thanks
    3,992
    My Mood
    Flirty
    DId you even create your line?
    You need to create lines just like you ened to create your font..

Similar Threads

  1. [Help] need help with login thing
    By pushdis15 in forum Visual Basic Programming
    Replies: 10
    Last Post: 07-03-2011, 12:24 PM
  2. [Help Request] Need help with thing
    By YuDi21 in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 2
    Last Post: 06-13-2011, 12:00 AM
  3. [Help Request] need help with modding
    By BayBee Alyn in forum Combat Arms Help
    Replies: 0
    Last Post: 04-27-2011, 10:06 PM
  4. Need help with 2-3 things
    By wezljkz in forum Visual Basic Programming
    Replies: 9
    Last Post: 03-26-2011, 02:55 PM
  5. need help with 2 easy thing (i'm idiot)
    By rangg in forum Call of Duty Modern Warfare 2 GSC Modding Help/Discussion
    Replies: 6
    Last Post: 02-03-2011, 12:05 PM