Sande Posted July 21, 2013 Share Posted July 21, 2013 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
TAPL Posted July 21, 2013 Share Posted July 21, 2013 The function toggleControl in client side does NOT require player element. Read the wiki again, if you haven't already. https://wiki.multitheftauto.com/wiki/ToggleControl Link to comment
Sande Posted July 21, 2013 Author Share Posted July 21, 2013 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
TAPL Posted July 21, 2013 Share Posted July 21, 2013 (edited) Where is the function enableVehicleGodMode? Why you don't use setVehicleDamageProof? Edited July 21, 2013 by Guest Link to comment
Sande Posted July 21, 2013 Author Share Posted July 21, 2013 I didnt post full script, i post only the "broken" area. So can someone make toggle controls work on this function?? (clientside) Link to comment
Sande Posted July 21, 2013 Author Share Posted July 21, 2013 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
TAPL Posted July 21, 2013 Share Posted July 21, 2013 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? Link to comment
Sande Posted July 21, 2013 Author Share Posted July 21, 2013 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
TAPL Posted July 21, 2013 Share Posted July 21, 2013 You sure it's client side at the meta? Link to comment
Sande Posted July 21, 2013 Author Share Posted July 21, 2013 Godmode turning on working, but when turn godmode on togglecontrols not goes false. and same when put godmode off toggle controls noes going back. Link to comment
Sande Posted July 21, 2013 Author Share Posted July 21, 2013 Does anyone know good event, when player join he gets godmode. Say if you know good event for that ! Link to comment
Moderators IIYAMA Posted July 21, 2013 Moderators Share Posted July 21, 2013 https://wiki.multitheftauto.com/wiki/On ... DataChange Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now