Fabio(GNR) Posted September 26, 2010 Share Posted September 26, 2010 (edited) I got this god-mode script: function godmode(attacker, weapon, bodypart) cancelEvent() end addEventHandler("onClientPlayerDamage", getLocalPlayer(), godmode) But i want it to enable/disable by a command, how to? Thanks! :D Edited September 27, 2010 by Guest Link to comment
50p Posted September 26, 2010 Share Posted September 26, 2010 Make a variable which will enable/disable "god-mode" with the command. Then check if the variable is true or false, if it's true then cancel event. Link to comment
Fabio(GNR) Posted September 27, 2010 Author Share Posted September 27, 2010 Make a variable which will enable/disable "god-mode" with the command. Then check if the variable is true or false, if it's true then cancel event. Could you explain me something about variables? BTW: your 50p's public resources is broken Link to comment
50p Posted September 27, 2010 Share Posted September 27, 2010 Yeah, sure: http://www.lua.org/pil/2.html Link to comment
Fabio(GNR) Posted September 27, 2010 Author Share Posted September 27, 2010 Yeah, sure: http://www.lua.org/pil/2.html Ok, im trying to understand now Sorry but it's kinda hard im a noob So if u put that print function on start and addcommandhandeler key print???? Sorry Link to comment
dzek (varez) Posted September 27, 2010 Share Posted September 27, 2010 don't use print. I thought you are better at this ... you don't know what what variable is? uh.... https://wiki.multitheftauto.com/wiki/Scr ... troduction Link to comment
Fabio(GNR) Posted September 27, 2010 Author Share Posted September 27, 2010 don't use print.I thought you are better at this ... you don't know what what variable is? uh.... https://wiki.multitheftauto.com/wiki/Scr ... troduction No not really I'll read EDIT: so if im right, a variable is something thats used alot? or by many scripts? EDIT2: Or to who/what it's aimed? EDIt3: Or something a script can recognize easily? Link to comment
Discord Moderators Zango Posted September 28, 2010 Discord Moderators Share Posted September 28, 2010 EDIT: so if im right, a variable is something thats used alot? or by many scripts?EDIT2: Or to who/what it's aimed? EDIt3: Or something a script can recognize easily? A variable is even a term used in basic maths at primary school It stores a value under a name given. ie. a = 2 b = 4 c = a + b d = "hello" e = a you can store everything under variables, elements, object, tables, etc. to toggle something, 50p described it pretty well. You need to set a variable to true when toggled, and perform the opposite when it's true and set it to false. for example: toggle = false function toggleTest() if not toggle == false then outputChatBox ("Toggled off.") toggle = false else toggle = true outputChatBox ("Toggled on.") end end addCommandHandler("toggle", toggleTest) 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