GerardWay Posted August 16, 2011 Share Posted August 16, 2011 guys what is wrong with this script? function EnableGodmode() GodMode=EnableGodmode outputChatBox (" #ff0000Godmode is now enabled!!!!",root,255,255,255,true) end addCommandHandler ("godmode", EnableGodmode) i was just messing around and trying to script different scripts but now i need info on this can anyone fix please? Link to comment
Arran Posted August 16, 2011 Share Posted August 16, 2011 local GodMode = false function EnableGodmode() if (not GodMode) then GodMode=true outputChatBox (" #ff0000Godmode is now enabled!!!!", 255, 255, 255, true) else GodMode=false outputChatBox (" #ff0000Godmode is now disabled!!!!", 255, 255, 255, true) end end addCommandHandler ("godmode", EnableGodmode) function godModeDamageCheck() if (GodMode) then cancelEvent() end end addEventHandler("onClientPlayerDamage", getLocalPlayer(), godModeDamageCheck) Link to comment
Discord Moderators Zango Posted August 17, 2011 Discord Moderators Share Posted August 17, 2011 a simpler way to toggle: strGodmodeMessage = " #ff0000Godmode is now: %s!!!!" function EnableGodmode() GodMode = not GodMode outputChatBox (strGodmodeMessage:format(GodMode), 255, 255, 255, true) end addCommandHandler ("godmode", EnableGodmode) Your original example was serverside. The above is clientside. If you want it to remain on the serverside, you should try something with onPlayerDamage + setElementHealth (with loss value) I'm not sure whether that'll prevent against hard deaths though. Link to comment
GerardWay Posted August 27, 2011 Author Share Posted August 27, 2011 Arran i used ur example and it came up in console that line 17 "getLocalPlayer" was invalid so can u fix it please? i have mtasa 1.1 if that helps and Zango your script doesnt work at all either 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