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 


Flying Script help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
abhijeet1001
Advanced Cheater
Reputation: 0

Joined: 10 Apr 2013
Posts: 87

PostPosted: Wed Jan 22, 2014 10:39 pm    Post subject: Flying Script help Reply with quote

Hello all i was working on a game its PC game small single player shooting game ( 42 Mb) "assualt cube "

i been trying to make a FLY hack by using (y axis coords) like when i click jump it increases my y axis value and when i leave the space bar it comes back to original ( to make it feel like flying ) now problem is its not working like i want to when i press spacebar it directly bumbs me at +200 on y axis and when i leave space bar i dont even come down , i know i didnt scripted it right but thats y i am asking here because i was unable to make it perfect

here is what i made
Code:
jump = 1
function checkKeys(timer)
  if (isKeyPressed(VK_SPACE)) then
    if jump ~= 10 then
      LuaCall(AobswapC("8B 4E 3C 89 56 08 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52","8B 8E C8 00 00 00 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52"))
      jump=10
    end
  else
    if jump ~= 1 then
      LuaCall(AobswapC("8B 8E C8 00 00 00 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52","8B 4E 3C 89 56 08 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52"))
      jump=1
    end
  end

end

t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)





Regards Smile


EDIT : got a tip from a friend Daspammer " i wasnt assigning the onkey functions so i did
Code:



jump = 1
function checkKeys(timer)
  if (isKeyPressed(VK_SPACE)) then
    if jump ~= 10 then
      onkeyDown(VK_SPACE,LuaCall(AobswapC("8B 4E 3C 89 56 08 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52","8B 8E C8 00 00 00 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52")))
      jump=10
    end
  else
    if jump ~= 1 then
      onkeyUp(VK_SPACE,LuaCall(AobswapC("8B 8E C8 00 00 00 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52","8B 4E 3C 89 56 08 89 4E 0C D8 46 0C D9 5E 0C 48 33 FF 85 C0 7E 1D 8B 15 DC BE 4F 00 52")))
      jump=1
    end
  end

end

t=createTimer(nil)
timer_setInterval(t, 100)
timer_onTimer(t, checkKeys)
timer_setEnabled(t, true)


function DEC_HEX(IN)
local B,K,OUT,I,D=16,"0123456789ABCDEF","",0
   if IN<1 then
  OUT=0
  return OUT
   end
while IN>0 do
I=I+1
IN,D=math.floor(IN/B),math.mod(IN,B)+1
OUT=string.sub(K,D,D)..OUT
end
return OUT
end
function Aobswap(search, change)
   aobs = AOBScan(search)
   if(aobs ~= nil) then
   j = stringlist_getCount(aobs)
   for i = 1, j do
   address=stringlist_getString(aobs,i-1)
   for i = 1, string.len(change), 3 do
   z = string.sub(change, i, i+2)
   x, y = string.find(z, "%?+")
   if (x == nil) then
   script=[[
   ]]..address.."+"..(DEC_HEX((i-1)/3))..[[:
   db ]]..z..[[
   ]]
   autoAssemble(script)
   end
   end
   end
   object_destroy(aobs);
   aobs=nil
end
end
function AobswapC(search, change)
   aobs = AOBScan(search)
   if(aobs == nil) then AobSwapCheck=false else
   j = stringlist_getCount(aobs)
   for i = 1, j do
   address=stringlist_getString(aobs,i-1)
   for i = 1, string.len(change), 3 do
   z = string.sub(change, i, i+2)
   x, y = string.find(z, "%?+")
   if (x == nil) then
   script=[[
   ]]..address.."+"..(DEC_HEX((i-1)/3))..[[:
   db ]]..z..[[
   ]]
   autoAssemble(script)
   end
   end
   end
   object_destroy(aobs);
   aobs=nil
   AobSwapCheck=true
  end
end







now even after doing that when i press SpaceBar in game i get his error
"[code]Error:[string "..."]:7: attempt to call global 'OnKeyDown' (a nil value)"


PS : i think aobscan is making it slow any other way to make the checking faster too ?


EDIT

i found out how to do that i use CE and set hotkeys to incease the y axis with 10 when space bar is pressed so if i keep ressing i keep getting upp upp works llike i want but any idea how to put this stuff in a script so i can make a trainer or something
Back to top
View user's profile Send private message
aailaa
How do I cheat?
Reputation: 0

Joined: 22 Oct 2012
Posts: 4
Location: India

PostPosted: Fri Feb 28, 2014 3:18 pm    Post subject: explain once more Reply with quote

Just one small doubt --- is there any way we can modify script for multiple key press and release.
_________________
-=
Back to top
View user's profile Send private message
!!kandidatus
How do I cheat?
Reputation: 0

Joined: 03 Jan 2014
Posts: 1

PostPosted: Sat Mar 01, 2014 1:11 am    Post subject: Reply with quote

yes
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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