• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Casino issue

Tyson12302

New Member
Joined
Aug 6, 2014
Messages
264
Reaction score
4
I've made a Casino script where you pull a lever and its random to if you win or lose. But when i try it i win almost 70% of the time. How can i make this 50% or make it more harder to win? Heres the script
Code:
function onUse(cid, item, frompos, item2, topos)
if item.uid == 5885 then
kasapos = {x=32361, y=32214, z=12, stackpos=255}
getkasa = getThingfromPos(kasapos)
winpos = {x=32361, y=32213, z=12}
if getkasa.itemid == 2160 and getkasa.type == 5 then
rand = math.random(4)
if rand == 1 or rand == 4 then
doRemoveItem(getkasa.uid,5)
doSendMagicEffect(kasapos,2)
doPlayerSendTextMessage(cid,22,"You lost 5 Crystal Coins :(.")
end
if rand == 2 or rand == 3 then
doRemoveItem(getkasa.uid,5)
doCreateItem(2160,15,winpos)
doSendMagicEffect(winpos,13)
doSendMagicEffect(topos,21)
doPlayerSendTextMessage(cid,22,"You won 15 Crystal Coins :).")
end
end
if getkasa.itemid == 2160 and getkasa.type == 10 then
rand = math.random(4)
if rand == 1 or rand == 4 then
doRemoveItem(getkasa.uid,10)
doSendMagicEffect(kasapos,2)
doPlayerSendTextMessage(cid,22,"You lost 10 Crystal Coins :(.")
end
if rand == 2 or rand == 3 then
doRemoveItem(getkasa.uid,10)
doCreateItem(2160,30,winpos)
doSendMagicEffect(winpos,13)
doSendMagicEffect(topos,21)
doPlayerSendTextMessage(cid,22,"You won 30 Crystal Coins :).")
end
end
if getkasa.itemid == 2160 and getkasa.type == 25 then
rand = math.random(4)
if rand == 1 or rand == 4 then
doRemoveItem(getkasa.uid,25)
doSendMagicEffect(kasapos,2)
doPlayerSendTextMessage(cid,22,"You lost 25 Crystal Coins :(.")
end
if rand == 2 or rand == 3 then
doRemoveItem(getkasa.uid,25)
doCreateItem(2160,75,winpos)
doSendMagicEffect(winpos,13)
doSendMagicEffect(topos,21)
doPlayerSendTextMessage(cid,22,"You won 75 Crystal Coins :) .")
end
end
if getkasa.itemid == 2160 and getkasa.type == 50 then
rand = math.random(4)
if rand == 1 or rand == 4 then
doRemoveItem(getkasa.uid,50)
doSendMagicEffect(kasapos,2)
doPlayerSendTextMessage(cid,22,"You lost 50 Crystal Coins :(.")
end
if rand == 2 or rand == 3 then
doRemoveItem(getkasa.uid,50)
doCreateItem(2160,100,winpos)
doCreateItem(2160,50,winpos)
doSendMagicEffect(winpos,13)
doSendMagicEffect(topos,21)
doPlayerSendTextMessage(cid,22,"You won 150 Crystal Coins :).")
end
end
if getkasa.itemid > 2160 or getkasa.itemid < 2160 then
doPlayerSendTextMessage(cid,22,"Place 5, 10, 25 or 50 Crystal Coins.")
end
if getkasa.itemid == 2160 and getkasa.type == 1 or getkasa.itemid == 2160 and getkasa.type == 2 or getkasa.itemid == 2160 and getkasa.type == 3 or getkasa.itemid == 2160 and getkasa.type == 4 or getkasa.itemid == 2160 and getkasa.type == 6 or getkasa.itemid == 2160 and getkasa.type == 7 or getkasa.itemid == 2160 and getkasa.type == 8
or getkasa.itemid == 2160 and getkasa.type == 9 or getkasa.itemid == 2160 and getkasa.type == 11 or getkasa.itemid == 2160 and getkasa.type == 12 or getkasa.itemid == 2160 and getkasa.type == 13 or getkasa.itemid == 2160 and getkasa.type == 14 or getkasa.itemid == 2160 and getkasa.type == 15 or getkasa.itemid == 2160 and getkasa.type == 16
or getkasa.itemid == 2160 and getkasa.type == 17 or getkasa.itemid == 2160 and getkasa.type == 18 or getkasa.itemid == 2160 and getkasa.type == 19 or getkasa.itemid == 2160 and getkasa.type == 20 or getkasa.itemid == 2160 and getkasa.type == 21 or getkasa.itemid == 2160 and getkasa.type == 22 or getkasa.itemid == 2160 and getkasa.type == 23
or getkasa.itemid == 2160 and getkasa.type == 24 or getkasa.itemid == 2160 and getkasa.type == 26 or getkasa.itemid == 2160 and getkasa.type == 27 or getkasa.itemid == 2160 and getkasa.type == 28 or getkasa.itemid == 2160 and getkasa.type == 29 or getkasa.itemid == 2160 and getkasa.type == 30 or getkasa.itemid == 2160 and getkasa.type == 31
or getkasa.itemid == 2160 and getkasa.type == 32 or getkasa.itemid == 2160 and getkasa.type == 33 or getkasa.itemid == 2160 and getkasa.type == 34 or getkasa.itemid == 2160 and getkasa.type == 35 or getkasa.itemid == 2160 and getkasa.type == 36 or getkasa.itemid == 2160 and getkasa.type == 37 or getkasa.itemid == 2160 and getkasa.type == 38
or getkasa.itemid == 2160 and getkasa.type == 39 or getkasa.itemid == 2160 and getkasa.type == 40 or getkasa.itemid == 2160 and getkasa.type == 41 or getkasa.itemid == 2160 and getkasa.type == 42 or getkasa.itemid == 2160 and getkasa.type == 43 or getkasa.itemid == 2160 and getkasa.type == 44 or getkasa.itemid == 2160 and getkasa.type == 45
or getkasa.itemid == 2160 and getkasa.type == 46 or getkasa.itemid == 2160 and getkasa.type == 47 or getkasa.itemid == 2160 and getkasa.type == 48 or getkasa.itemid == 2160 and getkasa.type == 49 or getkasa.itemid == 2160 and getkasa.type > 50 then
doPlayerSendTextMessage(cid,22,"Place 5, 10, 25 or 50 Crystal Coins on the tile in front of you.")
end
end
end
 
Code:
rand = math.random(4)
if rand == 1 or rand == 4 then

Edit those lines aswell as the other if statments, use use a lonely integer to make it harder:
Code:
if rand == 3 then
 
What do you mean. Lowest Numbers makes it harder?

Not in this case, the way it is setup is so you have a random integer generated of 4, if the integers match (ex 1 == 1) then that statment will be executed.
So one way to solve it would be to incrase the lower rates, ex
Code:
if(isInArray({1, 2, 3}, rand)) then
     -- low rate
end
 
Not in this case, the way it is setup is so you have a random integer generated of 4, if the integers match (ex 1 == 1) then that statment will be executed.
So one way to solve it would be to incrase the lower rates, ex
Code:
if(isInArray({1, 2, 3}, rand)) then
     -- low rate
end
Hmm would you show me how that would work in the whole script im a bit confused on where to put that. Thanks!
 
Hmm would you show me how that would work in the whole script im a bit confused on where to put that. Thanks!

TBH if you can't do that they you should learn some Lua before you even think of starting a server.
This is one of the easiest things you can do...
 
TBH if you can't do that they you should learn some Lua before you even think of starting a server.
This is one of the easiest things you can do...
I've learned alot of files such as XML,PHP,Java,Python but most of them are not like LUA. So i may be a little rusty with LUA but for the scripts im mostly ok, its just these small problems that i dont know what to do.
 
I've learned alot of files such as XML,PHP,Java,Python but most of them are not like LUA. So i may be a little rusty with LUA but for the scripts im mostly ok, its just these small problems that i dont know what to do.

Python is alot alike Lua.
You can do the same if statments as both PHP and Java except use then and end insted of {}.
Code:
if()

Either you are lying or you learned how to create an hello world program. * no offence *
 
Python is alot alike Lua.
You can do the same if statments as both PHP and Java except use then and end insted of {}.
Code:
if()

Either you are lying or you learned how to create an hello world program. * no offence *
It was quiet a long time when i learned the files.
 
Back
Top