Fabio(GNR) Posted September 26, 2010 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 LuaCompiler United Social Gamers [ CnR / DD / DM & more ]
50p Posted September 26, 2010 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. - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
Fabio(GNR) Posted September 27, 2010 Author 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 LuaCompiler United Social Gamers [ CnR / DD / DM & more ]
50p Posted September 27, 2010 Posted September 27, 2010 Yeah, sure: http://www.lua.org/pil/2.html - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
Fabio(GNR) Posted September 27, 2010 Author 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 LuaCompiler United Social Gamers [ CnR / DD / DM & more ]
dzek (varez) Posted September 27, 2010 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 Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
Fabio(GNR) Posted September 27, 2010 Author 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? LuaCompiler United Social Gamers [ CnR / DD / DM & more ]
Moderators Zango Posted September 28, 2010 Moderators 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)
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