Jump to content

Godmode script [HELP]


Sande

Recommended Posts

Posted

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) 

Posted
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...

Posted

I didnt post full script, i post only the "broken" area. So can someone make toggle controls work on this function?? (clientside)

Posted

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) 

Posted

What are you doing?

hello?

Use the previous code it's WORK, it's just that you don't want to show us the function enableVehicleGodMode?

I will repeat myself:

Where is the function enableVehicleGodMode?

Why you don't use setVehicleDamageProof?

Posted

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) 

Posted

Godmode turning on working, but when turn godmode on togglecontrols not goes false. and same when put godmode off toggle controls noes going back.

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...