Jump to content

Making a function toggle able?


Fabio(GNR)

Recommended Posts

Posted

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)!

  • Moderators
Posted
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) 
  

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