• 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!

Lua Casino Script - Doesn't give the money for winning!

Mikolaj

Banned User
Joined
Jun 11, 2010
Messages
92
Reaction score
2
Hello, I have a script for casino here...

Code:
--[ Script written and published by Devcod ]--
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config = {
		chance = math.random(1, 100), --losowanie
		win_chance = 25, --szansa na wygranie w procentach
		multi = 2, --ile razy wiecej sie wygrywa (np. 2 czyli stawiasz 1cc, wygrywasz i dostajesz 2cc)
		items = {2160, 2152}, --id itemow ktorymi mozna grac
		min_count = 1, --minimalna ilosc przedmiotow (1=minimum 1cc)
		max_count = 10 --maksymalna ilosc przedmiotow (10=maksimum 10cc)
	}	
	local positions = {
		[56501] = {x=(fromPosition.x-1), y=fromPosition.y, z=fromPosition.z, stackpos=255},
		[56502] = {x=(fromPosition.x+1), y=fromPosition.y, z=fromPosition.z, stackpos=255},
		[56503] = {x=(fromPosition.x+1), y=fromPosition.y, z=fromPosition.z, stackpos=255},
		[56504] = {x=(fromPosition.x-1), y=fromPosition.y, z=fromPosition.z, stackpos=255}
	}
	local itemplay = getThingfromPos(positions[item.actionid])	
	local storage, exh = 56500, 2 --storage id, czas exh
	if (item.itemid == 1945) then
		doTransformItem(item.uid, 1946)
		if (getPlayerStorageValue(cid, storage)-os.time(t) < 1) then
			doPlayerSetStorageValue(cid, storage, os.time(t)+exh)
			if (isInArray(config.items, itemplay.itemid)) then
				if (itemplay.type >= config.min_count) and (itemplay.type <= config.max_count) then
					if (config.chance <= config.win_chance) then
						doRemoveItem(itemplay.uid, itemplay.type)
						doCreateItem(itemplay.itemid, (itemplay.type*config.multi), positions[item.actionid])
						doSendMagicEffect(positions[item.actionid], 31)
						doSendMagicEffect(getCreaturePosition(cid), 27)
						doPlayerSendCancel(cid, "Congratulations, you just won in our casino!")
						doSendAnimatedText(getCreaturePosition(cid), "~!Winner!~", TEXTCOLOR_YELLOW)
						return true
					else
						doRemoveItem(itemplay.uid, itemplay.type)
						doSendMagicEffect(positions[item.actionid], 31)
						doSendMagicEffect(getCreaturePosition(cid), 13)
						doPlayerSendCancel(cid, "It is your unlucky day! You lost.")
						doSendAnimatedText(getCreaturePosition(cid), "~!Loser!~", TEXTCOLOR_LIGHTBLUE)
						return true							
					end
				else
					doPlayerSendCancel(cid, "You can play only with amount from ".. config.min_count .." to ".. config.max_count ..".")
					doSendMagicEffect(fromPosition, 2)
					return true			
				end
			else
				doPlayerSendCancel(cid, "You cannot play with this item.")
				doSendMagicEffect(fromPosition, 2)
				return true
			end
		else
			doPlayerSendCancel(cid, "You must wait another ".. getPlayerStorageValue(cid, storage)-os.time(t) .." seconds.")
			doSendMagicEffect(fromPosition, 2)
			return true
		end
	else
		doTransformItem(item.uid, 1945)
		doSendMagicEffect(fromPosition, 2)
		return true
	end
end

The problem is that when I win something. It shouts that I won but doesn't give me the reward... It only takes money from me...

Please do not change anything with chances of winning. I think there is something wrong with a line that is responsible for winning...

I need it very fast so I'd appreciate a quick answer :)

Thank you !!!!!
 
40 views and not even 1 reply?? Nice forum
If you can't find anything wrong in this script then please post that.... Because I am waiting like an idiot for an answer about this problem...
 
If im not wrong it creates example if you play with 5 marks it you will win 10 marks? ( 5 + 5 )
And the item must have a actionid for you to win it, have you set up everything correct?
56501 - 56504 is the actionids on the items to play with, the only thing i can see that is weird else is this:
LUA:
if (config.chance <= config.win_chance) then
						doRemoveItem(itemplay.uid, itemplay.type)
						doCreateItem(itemplay.itemid, (itemplay.type*config.multi), positions[item.actionid])
						doSendMagicEffect(positions[item.actionid], 31)
						doSendMagicEffect(getCreaturePosition(cid), 27)
						doPlayerSendCancel(cid, "Congratulations, you just won in our casino!")   <<< Why the F*ing hell is there a Cancel function b4 the "if" is done?^.-
						doSendAnimatedText(getCreaturePosition(cid), "~!Winner!~", TEXTCOLOR_YELLOW)
						return true
 
Back
Top