Jump to content

Godmode script [HELP]


Sande

Recommended Posts

Can someone fix this, something is wrong online 12. in togglecontrol (this is clientside)

  
function toggleGodMode() 
    if getPlayerTeam (getLocalPlayer()) then 
        local team = getPlayerTeam (getLocalPlayer()) 
        if getTeamName (team) == "Freeroam" then 
            godModeEnabled = not godModeEnabled 
            if godModeEnabled then 
                outputChatBox ("Godmode enabled!", 0, 255, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    enableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer())) 
                                        toggleControl ( getLocalPlayer()), "vehicle_fire", false ) 
                                        toggleControl ( getLocalPlayer()), "vehicle_secondary_fire", false ) 
                                        toggleControl ( getLocalPlayer()), "aim_weapon", false ) 
                                        toggleControl ( getLocalPlayer()), "next_weapon", false) 
                                        toggleControl ( getLocalPlayer()), "previous_weapon", false) 
                                        toggleControl ( getLocalPlayer()), "fire", false) 
                end 
            else 
                outputChatBox ("Godmode disabled!", 255, 0, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    disableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer())) 
                                        toggleControl ( getLocalPlayer()), "vehicle_fire", true ) 
                                        toggleControl ( getLocalPlayer()), "vehicle_secondary_fire", true ) 
                                        toggleControl ( getLocalPlayer()), "aim_weapon", true ) 
                                        toggleControl ( getLocalPlayer()), "next_weapon", true) 
                                        toggleControl ( getLocalPlayer()), "previous_weapon", true) 
                                        toggleControl ( getLocalPlayer()), "fire", true) 
                end 
            end 
        end 
    end 
end 
  
addCommandHandler("godmode", toggleGodMode) 

Link to comment
godModeEnabled = true 
  
function toggleGodMode() 
    if getPlayerTeam (getLocalPlayer()) then 
        local team = getPlayerTeam (getLocalPlayer()) 
        if getTeamName (team) == "Freeroam" then 
            godModeEnabled = not godModeEnabled 
            if godModeEnabled then 
                outputChatBox ("Godmode enabled!", 0, 255, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    enableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer())) 
                                        toggleControl ( "vehicle_fire", false ) 
                                        toggleControl ( "vehicle_secondary_fire", false ) 
                                        toggleControl ( "aim_weapon", false ) 
                                        toggleControl ( "next_weapon", false) 
                                        toggleControl ( "previous_weapon", false) 
                                        toggleControl ( "fire", false) 
                end 
            else 
                outputChatBox ("Godmode disabled!", 255, 0, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    disableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer()))  
                                        toggleControl ( "vehicle_fire", true ) 
                                        toggleControl ( "vehicle_secondary_fire", true ) 
                                        toggleControl ( "aim_weapon", true ) 
                                        toggleControl ( "next_weapon", true) 
                                        toggleControl ( "previous_weapon", true) 
                                        toggleControl ( "fire", true) 
                end 
            end 
        end 
    end 
end 
  
addCommandHandler("godmode", toggleGodMode) 

Not woorkk...

Link to comment

New code, but stil togglecontrol not working. (clientside)

  
godModeEnabled = true 
  
function toggleGodMode() 
    if getPlayerTeam (getLocalPlayer()) then 
        local team = getPlayerTeam (getLocalPlayer()) 
        if getTeamName (team) == "Freeroam" then 
            godModeEnabled = not godModeEnabled 
            if godModeEnabled then 
                outputChatBox ("Godmode enabled!", 0, 255, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    enableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer())) 
                                        toggleControl ( vehicle_fire, false ) 
                                        toggleControl ( vehicle_secondary_fire, false ) 
                                        toggleControl ( aim_weapon, false ) 
                                        toggleControl ( next_weapon, false) 
                                        toggleControl ( previous_weapon, false) 
                                        toggleControl ( fire, false) 
                end 
            else 
                outputChatBox ("Godmode disabled!", 255, 0, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    disableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer()))  
                                        toggleControl ( vehicle_fire, true ) 
                                        toggleControl ( vehicle_secondary_fire, true ) 
                                        toggleControl ( aim_weapon, true ) 
                                        toggleControl ( next_weapon, true) 
                                        toggleControl ( previous_weapon, true) 
                                        toggleControl ( fire, true) 
                end 
            end 
        end 
    end 
end 
  
addCommandHandler("godmode", toggleGodMode) 

Link to comment

Full script

  
godModeEnabled = true 
  
function toggleGodMode() 
    if getPlayerTeam (getLocalPlayer()) then 
        local team = getPlayerTeam (getLocalPlayer()) 
        if getTeamName (team) == "Freeroam" then 
            godModeEnabled = not godModeEnabled 
            if godModeEnabled then 
                outputChatBox ("Godmode enabled!", 0, 255, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    enableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer())) 
                                        toggleControl ( "vehicle_fire", false ) 
                                        toggleControl ( "vehicle_secondary_fire", false ) 
                                        toggleControl ( "aim_weapon", false ) 
                                        toggleControl ( "next_weapon", false) 
                                        toggleControl ( "previous_weapon", false) 
                                        toggleControl ( "fire", false) 
                end 
            else 
                outputChatBox ("Godmode disabled!", 255, 0, 0, true) 
                if getVehicleOccupant(getPedOccupiedVehicle(getLocalPlayer()), 0) == getLocalPlayer() then 
                    disableVehicleGodMode(getPedOccupiedVehicle(getLocalPlayer()))  
                                        toggleControl ( "vehicle_fire", true ) 
                                        toggleControl ( "vehicle_secondary_fire", true ) 
                                        toggleControl ( "aim_weapon", true ) 
                                        toggleControl ( "next_weapon", true) 
                                        toggleControl ( "previous_weapon", true) 
                                        toggleControl ( "fire", true) 
                end 
            end 
        end 
    end 
end 
  
addCommandHandler("godmode", toggleGodMode) 
  
function playerDamageHandler() 
    if getPlayerTeam (getLocalPlayer()) then 
        local team = getPlayerTeam (getLocalPlayer()) 
        if getTeamName (team) == "Freeroam" then 
            if godModeEnabled and source == getLocalPlayer() then 
                cancelEvent() 
            end 
        end 
    end 
end 
  
addEventHandler("onClientPlayerDamage", getRootElement(), playerDamageHandler) 
  
function enableVehicleGodMode(vehicle) 
    setVehicleDamageProof(vehicle, true) 
    setVehicleFuelTankExplodable(vehicle, false) 
end 
  
function disableVehicleGodMode(vehicle) 
    setVehicleDamageProof(vehicle, false) 
    setVehicleFuelTankExplodable(vehicle, true) 
end 
  
function vehicleEnterHandler(vehicle, seat) 
    if getPlayerTeam (getLocalPlayer()) then 
        local team = getPlayerTeam (getLocalPlayer()) 
        if getTeamName (team) == "Freeroam" then 
            if godModeEnabled and seat == 0 then 
                enableVehicleGodMode(vehicle) 
            end 
        end 
    end 
end 
  
addEventHandler("onClientPlayerVehicleEnter", getRootElement(), vehicleEnterHandler) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...