raulrobi Posted April 19, 2010 Share Posted April 19, 2010 I have makd a roll script function roll(player.comd) local roll = math random(1.6) if roll = 1 then u won blablabla if roll = 2 u lost blablabla if roll = 3 u r muted if roll = 4 u win blablabla addCommandHandler(("roll",roll) it doesent work.CAN ANYONE REPAIR IT PLS. Link to comment
bober370 Posted April 19, 2010 Share Posted April 19, 2010 lol function roll(player.comd) local roll = math random(1.6) if roll = 1 then u won blablabla elseif roll = 2 then u lost blablabla elseif roll = 3 then u r muted elseif roll = 4 then u win blablabla end end addCommandHandler(("roll",roll) Link to comment
dzek (varez) Posted April 19, 2010 Share Posted April 19, 2010 omg teach yourself how top script.. this doesnt make sense Link to comment
Dark Dragon Posted April 19, 2010 Share Posted April 19, 2010 function roll(player,command) -- a comma between parameters not a decimal point local rand = math.random(1,6) -- math.random (with a decimal point and also a comma to separate the parameters of math.random) if rand == 1 then -- == instead of = when comparing -- do something elseif rand == 2 then -- do something else elseif rand == 3 then -- do something else elseif rand == 4 then -- do something else elseif rand == 5 then -- do something else else -- do something else end -- end for the if in line 4 end -- end of the function addCommandHandler("roll",roll) -- add the command handler Link to comment
karlis Posted April 19, 2010 Share Posted April 19, 2010 (edited) function rolldice(player,comd) local roll = math.random(1,4) if roll == 1 then outputChatBox("u won blablabla") elseif roll == 2 then outputChatBox("u lost blablabla") elseif roll == 3 then setPlayerMuted(source,true); setTimer(setPlayerMuted,1,30000,player,false) elseif roll == 4 then outputChatBox("u win blablabla") end end addCommandHandler("roll",rolldice) Edited April 22, 2010 by Guest Link to comment
50p Posted April 19, 2010 Share Posted April 19, 2010 function roll(player,comd) local roll = math.random(1,4) if roll == 1 then outputChatBox("u won blablabla") elseif roll == 2 then outputChatBox("u lost blablabla") elseif roll == 3 then setPlayerMuted(source,true); setTimer(function() setPlayerMuted(source,false) end,1,30000) elseif roll == 4 then outputChatBox("u win blablabla") end end addCommandHandler("roll",roll) I do not recommend calling variables the same names as functions. Link to comment
raulrobi Posted April 20, 2010 Author Share Posted April 20, 2010 thank you for helping Link to comment
raulrobi Posted April 20, 2010 Author Share Posted April 20, 2010 ah i rolled and in the console it says: Acces denied @ 'setPlayerMuted' - line : 5 Link to comment
karlis Posted April 20, 2010 Share Posted April 20, 2010 you need give acl admin rights to acl, find how to in wiki Link to comment
COOKIE2 Posted April 21, 2010 Share Posted April 21, 2010 it doesnt work for me http://rapidshare.com/files/378590061/roll.zip.htm can someone look what i did wrong please Link to comment
dzek (varez) Posted April 22, 2010 Share Posted April 22, 2010 you.. posted.. 400 bytes script.. on.. RAPIDSHARE? I'm sure, that nobody will care.. post your code on forums.. or use pastebin.com or something, but not RAPIDSHARE! Link to comment
Castillo Posted April 22, 2010 Share Posted April 22, 2010 you.. posted.. 400 bytes script.. on.. RAPIDSHARE?I'm sure, that nobody will care.. post your code on forums.. or use pastebin.com or something, but not RAPIDSHARE! this is his code, addCommandHandler("roll",rolldice) function rolldice(player,comd) local roll = math.random(1,4) if roll == 1 then outputChatBox("u won") elseif roll == 2 then outputChatBox("u lost") elseif roll == 3 then setPlayerMuted(source,true); setTimer(function() setPlayerMuted(source,false) end,1,30000) elseif roll == 4 then outputChatBox("u win") end end Link to comment
dzek (varez) Posted April 22, 2010 Share Posted April 22, 2010 cookie2, when you are adding event/command handler, the handler function MUST be defined BEFORE adding handler.. in other words: if you copy ready script from here, don't change it if you don't know what are you doing Link to comment
COOKIE2 Posted April 22, 2010 Share Posted April 22, 2010 this doesnt work (i open notepad and paste in it then i do save as then i type roll.lua) function roll(player,comd) local roll = math.random(1,4) if roll == 1 then outputChatBox("u won blablabla") elseif roll == 2 then outputChatBox("u lost blablabla") elseif roll == 3 then setPlayerMuted(source,true); setTimer(function() setPlayerMuted(source,false) end,1,30000) elseif roll == 4 then outputChatBox("u win blablabla") addCommandHandler("roll",roll) end end Link to comment
dzek (varez) Posted April 22, 2010 Share Posted April 22, 2010 COOKIE FFS!! Use that damn [ LUA] tags! and now: go to the 4th post of this topic. copy and paste and NOTHING MORE. And it will be fine.. Every post you are just messing the script, i dont know why? Maybe you tell me? Link to comment
COOKIE2 Posted April 22, 2010 Share Posted April 22, 2010 i dont get it can u post it here please Link to comment
Aibo Posted April 22, 2010 Share Posted April 22, 2010 it would be much easier for you if you'd have any idea about programming at all. this code is already a bit messy, you're just messing it up even more: addCommandHandler("roll", function(player,comd) local roll = math.random(1,4) if roll == 1 then outputChatBox("u won blablabla", player) -- no player was specified, message'd be shown to all elseif roll == 2 then outputChatBox("u lost blablabla", player) elseif roll == 3 then setPlayerMuted(player, true) -- as i recall, "source" is not passed by command handler, use "player", but i may be wrong setTimer(setPlayerMuted, 30000, 1, player, false) -- what's more, setTimer parameters were messed up, 30000 executions with 1ms interval. elseif roll == 4 then outputChatBox("u win blablabla", player) end end ) Link to comment
dzek (varez) Posted April 22, 2010 Share Posted April 22, 2010 your tryings are worthless, xbost.. he will edit that script Link to comment
raulrobi Posted April 24, 2010 Author Share Posted April 24, 2010 COOKIE2 STOP STEAHLING SCRIPTS AND SCRIPT IT ONE.NOOOOB Link to comment
raulrobi Posted April 24, 2010 Author Share Posted April 24, 2010 and for win at line 4 is: if roll == 1 then outputChatBox("u won blablabla", player) givePlayerMoney((source)100) Link to comment
Taalasmaa Posted April 24, 2010 Share Posted April 24, 2010 Seriously, somebody need to ban the COOKIE12... 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