PartyMTA Posted June 17, 2014 Posted June 17, 2014 hi,i made this little script with the method of Archimedes to calculate the Pi. function getPi(commandName,number) calc = number*math.sin(0.5/number) outputChatBox(calc) end addCommandHandler("pi",getPi) Command: /pi (number) change (number) to the wished number. Without ()! its actually easy to make this. i just was bored
Saml1er Posted June 17, 2014 Posted June 17, 2014 function getPi(commandName,number) number = tonumber ( number ) if number then -- if we converted it into a number then lets proceed ..... calc = number*math.sin(0.5/number) outputChatBox(calc) end end addCommandHandler("pi",getPi) Well good luck. Your efforts are always appreciated.
MIKI785 Posted June 17, 2014 Posted June 17, 2014 What about this? math.pi Isnt that actually the same? Lua Scripter Owner of mshost.cz MTA portal.
50p Posted June 17, 2014 Posted June 17, 2014 I'm confused. What's the point of this script? Why calculate pi? How are you going to calculate pi by passing a number to the command? print( math.pi ); -- or if accuracy isn't that important to you: print( 22/7 ); - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
PartyMTA Posted June 17, 2014 Author Posted June 17, 2014 What about this? math.pi Isnt that actually the same? That will go up to 13 decimals, this code will go to ~15 decimals
PartyMTA Posted June 17, 2014 Author Posted June 17, 2014 I'm confused. What's the point of this script? Why calculate pi? How are you going to calculate pi by passing a number to the command? print( math.pi ); -- or if accuracy isn't that important to you: print( 22/7 ); i just was bored
50p Posted June 17, 2014 Posted June 17, 2014 Still, How are you going to calculate pi by passing a number to the command? - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
ixjf Posted June 17, 2014 Posted June 17, 2014 Wasn't that pointless function "binary" you placed all over the wiki while you attempted to "hack" the wiki enough? I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
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