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 


help with Error:The d3dhook object has not been created yet

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
SetDmg
How do I cheat?
Reputation: 0

Joined: 09 Dec 2013
Posts: 4

PostPosted: Thu Mar 06, 2014 10:33 am    Post subject: help with Error:The d3dhook object has not been created yet Reply with quote

Help me pls, this is my code:

Code:

form_show(TrainerSH)
control_setCaption(TrainerSH, "[Crosshair]Trainer [Not Included]")
autoAttachList = getAutoAttachList()
stringlist_add(autoAttachList, "Game.exe")

--Crosshair
function Crosshair()
 d3dhook_initializeHook()

 CrosshairTexture=d3dhook_createTexture("Crosshair.png")

 CrosshairSprite=d3dhook_createSprite(CrosshairTexture);
 d3dhook_renderobject_setX(CrosshairSprite, -1) --center it horizontally
 d3dhook_renderobject_setY(CrosshairSprite, -1) --center it vertical
 d3dhook_sprite_setWidth(CrosshairSprite,15)    --Width
 d3dhook_sprite_setHeight(CrosshairSprite,15)  --Height
 d3dhook_renderobject_setAlphablend(CrosshairSprite, 1.0) --Alpha Channel (Visibility level)

 control_setCaption(TrainerSH, "[Crosshair]Trainer [Enabled]")
end
--Crosshair

function OnCheckHotkeys()
d3dhook_initializeHook()
if isKeyPressed(VK_F1) then
Crosshair()
return
end
end

function FromClose(sender)
closeCE()
return caFree
end

function onOpenProcess(processid)
control_setCaption(TrainerSH, "[Crosshair]Trainer [Included]")
hotKeyTimer = createTimer(trainerForm)
timer_setInterval(hotKeyTimer, 100)
timer_onTimer(hotKeyTimer, OnCheckHotkeys)
end


When I compile this into .exe it gives an error when I try to use it: *error: The d3dhook object has not been created yet* , but if I launch it from .CT it runs perfectly, what am I doing wrong?

and how do i remove crosshair when i need it?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Mar 06, 2014 11:06 am    Post subject: Reply with quote

For 32 bit trainer you must add those:



For 64 bit trainer you must add those:



You can skip *d3d9* files if you are 100% sure that game doesn't use it.

That means, if you create trainer for old game which have only DX9, and is only 32bit, you need only two files d3dhook.dll and ced3d9hook.dll.


"I launch it from .CT it runs perfectly"
It doesn't work perfectly. Your script is creating new render object and texture every time VK_F1 is pressed.


So, I recommend to try auto generated trainer.
Just check "Use Direct3D Hook" (you can also click configure). Then choose output: "script only". Then click "generate". You will see complete example.

Note: some games doesn't like D3D hook. Expect crashes and etc.

_________________
Back to top
View user's profile Send private message MSN Messenger
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