raulrobi Posted May 6, 2010 Share Posted May 6, 2010 Hey,i found a roll script from kevin11 and i added somethinks,but it didnt works.Can anyone help me?here is the script local restriction = nil addCommandHandler("roll", function(thePlayer,comd) if restriction then outputChatBox( "your message", getRootElement(), 255, 0, 0) return false; end restriction = true local resetRestriction = setTimer( restrictionEnd, 30000,1) randomroll = math.random(1, 3000) roller = math.random(1, 4) if roller == 1 then givePlayerMoney(thePlayer, math.random(1,10000)) outputChatBox ( getPlayerName ( thePlayer ) .. ' roll and wins ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) elseif roller == 2 then takePlayerMoney(thePlayer, math.random(1,10000)) outputChatBox ( getPlayerName ( thePlayer ) .. ' roll and losses ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) elseif roller == 3 then setPlayerMuted(player, true) setTimer(setPlayerMuted, 30000, 1, player, false) outputChatBox (outputChatBox ( getPlayerName ( thePlayer ) .. ' roll and is now muted !', getRootElement(), 255, 255, 0) elseif roller == 4 then setSkyColour (math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ) outputChatBox( getPlayerName ( thePlayer ) .. ' roll and is now changed the sky colour !', getRootElement(), 255, 255, 0) end end ) function restrictionEnd() restriction = false; end Link to comment
Nich Posted May 6, 2010 Share Posted May 6, 2010 Don't copy other's stuff, instead make one from scratch, this way you'll learn something also and understand what you are doing. Hint: function has to exist, in order to use it, use wiki. Link to comment
Jason_Gregory Posted May 6, 2010 Share Posted May 6, 2010 this is mine:D Nope and btw. use the [lua] Tags Link to comment
raulrobi Posted May 8, 2010 Author Share Posted May 8, 2010 I need an anwanser plsssssssssssssssssssssss Link to comment
kevin11 Posted May 8, 2010 Share Posted May 8, 2010 i ment this is from my topic.... btw isnt this topic 10000000000 that contains /roll problems? Link to comment
Aibo Posted May 9, 2010 Share Posted May 9, 2010 0. use [luа] tag ffs, you'll see at least syntax errors in your code (on a second thought, you won't anyway) 1. you're using a different player variables again (thePlayer and player) 2. what is "outputChatBox (outputChatBox ( getPlayerName(..."? 3. you're randomizing one amount at randomroll, and then totally different in money functions 4. this kind "restriction" stuff will work on ALL players, you need to add personal timers 5. its not setSkyColour, but setSkyGradient 6. what are you trying to do here (basically, replicate the /roll command from DDC) is stupid, since the original idea is quite stupid too. and the way you're doing it (creating 100500 topics for a simplest piece of code) is even stupider. anyway, i'm too lazy to test: restriction = {} addCommandHandler("roll", function(thePlayer) local playerName = getPlayerName(thePlayer) if restriction[playerName] then outputChatBox("your message", thePlayer, 255, 0, 0) else restriction[playerName] = true setTimer(restrictionEnd, 30000, 1, playerName) randomroll = math.random(1, 3000) roller = math.random(1, 4) if roller == 1 then givePlayerMoney(thePlayer, randomroll) outputChatBox(playerName .. ' roll and wins ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) elseif roller == 2 then takePlayerMoney(thePlayer, randomroll) outputChatBox(playerName .. ' roll and losses ' .. randomroll .. ' !', getRootElement(), 255, 255, 0) elseif roller == 3 then setPlayerMuted(thePlayer, true) setTimer(setPlayerMuted, 30000, 1, thePlayer, false) outputChatBox(playerName .. ' roll and is now muted !', getRootElement(), 255, 255, 0) elseif roller == 4 then setSkyGradient(math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255) ,math.random(1, 255)) outputChatBox(playerName .. ' roll and is now changed the sky colour !', getRootElement(), 255, 255, 0) end end end ) function restrictionEnd(playerName) restriction[playerName] = nil end i hope this was the last question about your "super advanced roll", if not - please keep it in this topic. 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