Reply To: Mafia 3 – Godmodescript – Need help

Download Mods for the Mafia Games Forums Mod Creation Mafia 3 – Godmodescript – Need help Reply To: Mafia 3 – Godmodescript – Need help

#163393
SladernimoSladernimo
Participant

First problem is that togglePlayerGodMode never can be 0 or 1 because you say

 

togglePlayerGodMode = 0; — here you set variable value to 0.

togglePlayerGodMode = [[ — here you use the same variable and set value to a code block.

 

Also invulnerability should be used like that:

game.game:GetActivePlayer().invulnerability = true; — the “;” sign is not needed in lua but can be used

 

So for example your code could look like this:

togglePlayerGodModeSetting = 0

togglePlayerGodModeFunction = [[
if togglePlayerGodModeSetting == 0 then
game.game:GetActivePlayer():InventorySetUnlimitedAmmo(true)
game.game:GetActivePlayer().invulnerability = true
togglePlayerGodModeSetting = 1
elseif togglePlayerGodModeSetting == 1 then
game.game:GetActivePlayer():InventorySetUnlimitedAmmo(false)
game.game:GetActivePlayer().invulnerability = false
togglePlayerGodModeSetting = 0
end
]]

unbindKey(“o”)
bindKey(“o”, togglePlayerGodModeFunction)

 

For additional help take a look at the scripting wiki and its links at http://mafia3scripting.wikia.com/

Everyone can help to contibute the wiki 🙂