FileForums

FileForums (//fileforums.com/index.php)
-   Game Coders (//fileforums.com/forumdisplay.php?f=36)
-   -   Stronghold3 Trainer source code (by sicheats) (//fileforums.com/showthread.php?t=92145)

cocodrilo 27-10-2011 14:58

Stronghold3 Trainer source code (by sicheats) Added god mode
 
This is the source code for the sicheats trainer, to run is necesary a dll included in the download rar. source of dll is not need, only loads a lua script and handle the onKeyDown function.

EDITED: added resources option.

Fixed: environment script execution fixed in the dll. link to dll http://www.megaupload.com/?d=UO8TMT05

Code:

--StrongHold3 trainer by cocodrilo.
--can you make your own options.
-- www.sicheats.com

function getLocalPlayer()
 local e = { GameLib.GetEstates() }
 for n,tmp in ipairs(e) do
  if tmp and tmp:GetPlayer():IsHumanControlled() then
    return tmp
  end
 end
 return nil
end

function addGold(gValue)
 local miPlayer = getLocalPlayer()
 if miPlayer~=nil then
  miPlayer.m_gameState.iGold = miPlayer.m_gameState.iGold + gValue
 end
end

function addHonour(hValue)
 local miPlayer = getLocalPlayer()
 if miPlayer~=nil then
  miPlayer.m_gameState.iHonour  = miPlayer.m_gameState.iHonour + hValue
 end
end

function addResources(rValue)
 local miPlayer = getLocalPlayer()
 if miPlayer~=nil then
  for i=1,31 do
    miPlayer.m_gameState.hResources[i] = Inc(miPlayer.m_gameState.hResources[i],rValue)
  end
 end
end

function Inc(a,b)
 return a+b
end

--Hooked Damage function. simply return, not call the original.
function miDamage()
 return
end

function setGodMode()
 local ent = GameLib.GetEntityUnderMouse()
 if ent~=nil then
  ent.Damage = miDamage
 end
end

function onKeyDown(key)
 if key==112 then  --F1: add gold
  addGold(5000)
 elseif key==113 then  --F2: add honour
  addHonour(1000)
 elseif key==114 then  --F3: no build costs
  Game.Options.Cheats.bNoBuildCosts = true
 elseif key==115 then  --F4: add resources
  addResources(1000)
 elseif key == 116 then -- F5: add god mode to selected unit
  setGodMode()
 end
end


ptsz 28-11-2011 09:11

How do you run the dll though?

I saw your trainer also on sicheats but its down at the moment.

cocodrilo 28-11-2011 13:26

winject or another injector.

ptsz 28-11-2011 17:13

Thanks man. I got it working. Nice trainer.

STN 30-11-2011 17:07

Huh not really a source, the title is misguiding. It is just your dll that people have to manually inject themselves instead of using your main trainer gui (which might be good, peeps don't have to go through the drm stuff)

The lua script is even using custom key codes for hotkeys, you should mention all the key codes so at least users can change the hotkeys.

This might help.
http://en.wikipedia.org/wiki/Source_code

cocodrilo 01-12-2011 17:12

Quote:

Huh not really a source
¿no? trainer is written in lua, this is the source code.

¿what is my GUI? I don't have a GUI. there are a lot of injectors ¿I need to write another?.

Quote:

The lua script is even using custom key codes for hotkeys, you should mention all the key codes so at least users can change the hotkeys.
is obvious, the key codes are a VK_* constants from Windows. "onKeyDown" is a simple wrapper from WindowProc ...

if this is not the source code ¿what is it?.

the dll only calls to lua_loadfile and lua_pcall to load this source code in game. and have a custom windowproc to handle keys in lua script ¿is this interestings?.

STN 04-12-2011 09:30

I was talking about the addresses since that included would make a complete source. And the hotkeys, yeah they are virtual keycodes actually but in decimel. I thought they were your customs ones since MSDN etc brings hex codes and i was thinking in hex.

Anyway, yeah its pretty customizable so i guess it counts as a source.

cocodrilo 05-12-2011 10:31

Quote:

I was talking about the addresses
what addresses?.

this game uses lua from a dll, not is statically linked. I using GetProcAddress to get functions from lua. in statically linked versions is need to find a pattern (per function), but isn't this case.

the_true_love72 31-05-2013 11:53

plz can anybody reupload the dll ?!


All times are GMT -7. The time now is 05:34.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Copyright 2000-2018, FileForums @ https://fileforums.com