Jump to content

roll script.help me pls


raulrobi

Recommended Posts

Posted

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.

Posted

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)

Posted
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

Posted (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 by Guest
Posted
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.

Posted

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!

Posted
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

Posted

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

Posted

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

Posted

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?

Posted

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 
)

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