Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Problem with function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Sun Aug 30, 2009 3:23 pm    Post subject: Problem with function Reply with quote

hi

ive created a function, but it doesnt work 100%

Code:
void UnlimitedAttkOn (HWND hWnd)
{
   int OldXPos = 0;
   SetDlgItemText(hWnd, IDC_UNLIMITEDATTK, "On" ); //On
   unsigned int LWall = (ReadPointer((ULONG_PTR*)LeftWall, LeftWallOffset));
   unsigned int RWall = (ReadPointer((ULONG_PTR*)RightWall, RightWallOffset));
   unsigned int Char = (ReadPointer((ULONG_PTR*)CharMapBytes, CharXBytes));
   int counter = 0;

   while (!UnlimitedAttkExit)
   {
      if (ReadPointer((ULONG_PTR*)AttkReadBase, AttkReadOffsetCharBase) >= 99)
      {
         OldXPos = ReadPointer((ULONG_PTR*)CharMapBytes, CharXBytes); //Get Old X Pos
         while (ReadPointer((ULONG_PTR*)AttkReadBase, AttkReadOffsetCharBase) >= 99)
         {   
            if (counter = 1)
            {
               if ( RWall <= (ReadPointer((ULONG_PTR*)ItemPBase, ItemBaseOffset)) + 15)
               {
               counter = 0;
               }
               else   
               {
               *(DWORD*)(*(DWORD*)ItemPBase + ItemBaseOffset) = OldXPos + 15;
                   Sleep (1);
               }
            }
            else
            {
               if ( LWall >= (ReadPointer((ULONG_PTR*)ItemPBase, ItemBaseOffset)) - 15)
               {
               counter = 1;
               }

               else   
               {
               *(DWORD*)(*(DWORD*)ItemPBase + ItemBaseOffset) = OldXPos - 15;
                   Sleep (1);
               }
            }
         }
      }
      Sleep (100);
   }

   SetDlgItemText(hWnd, IDC_UNLIMITEDATTK, "Off" );
}


Its something that reset the attack counter of a game, so the coordinates of the character goes -15, but if u touch the wall , its bans u, so i thought i create a check for that, so it goes + 15 till the attack counter has reseted itself by time:)



it works fine when im not against a wall, so i think it has something to do with the counter
Back to top
View user's profile Send private message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sun Aug 30, 2009 6:08 pm    Post subject: Reply with quote

herp derp. Crying or Very sad
_________________


Last edited by manc on Mon Aug 31, 2009 8:00 am; edited 1 time in total
Back to top
View user's profile Send private message
HolyBlah
Master Cheater
Reputation: 2

Joined: 24 Aug 2007
Posts: 446

PostPosted: Sun Aug 30, 2009 7:58 pm    Post subject: Reply with quote

Code:
if (counter = 1)
will always return true.
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Mon Aug 31, 2009 1:17 am    Post subject: Reply with quote

manc wrote:
might want to reconsider your use of loops

it will go straight to the else if you didnt know that.


i dont see why that would happen Embarassed

HolyBlah wrote:
Code:
if (counter = 1)
will always return true.


why? if counter = 0?
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Aug 31, 2009 1:30 am    Post subject: Reply with quote

NoMercy wrote:
manc wrote:
might want to reconsider your use of loops

it will go straight to the else if you didnt know that.


i dont see why that would happen Embarassed

HolyBlah wrote:
Code:
if (counter = 1)
will always return true.


why? if counter = 0?


= is assignment, == is comparison

manc is wrong, if(counter = 1) will make counter equal 1, which will have the glorious result of making it so you will never get to the else.
Back to top
View user's profile Send private message
NoMercy
Master Cheater
Reputation: 1

Joined: 09 Feb 2009
Posts: 289

PostPosted: Mon Aug 31, 2009 1:41 am    Post subject: Reply with quote

omg, thanks so stupid of me Very Happy

i changed it to ==, but still i did something wrong O.o i thought i did it well
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites