• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action script casino

andrewss

Nice Member
Joined
Jun 12, 2010
Messages
122
Reaction score
1
Location
E G Y P T
i will show the script of casino
it's for tfs 0.3.6
open data/actions/scripts add casino
Code:
--[ Script written and published by andrewss ]--
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config = {
		chance = math.random(1, 100), --losowanie
		win_chance = 28, --chance to win a percentage of
		multi = 2, --how many times you win more (eg 2 or 1cc bet, win and get 2cc)
		items = {2160, 2152}, --id items whom you can play
		min_count = 1, --Minimum Number of items (1 = least 1cc)
		max_count = 100 --maximum number of objects (100 = maximum 100cc)
	}	
	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, y=(fromPosition.y-1), z=fromPosition.z, stackpos=255},
		[56504] = {x=fromPosition.x, y=(fromPosition.y+1), z=fromPosition.z, stackpos=255}
	}
	local itemplay = getThingfromPos(positions[item.actionid])	
	local storage, exh = 56500, 2 --storage id, time 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], 17)
						doSendMagicEffect(getCreaturePosition(cid), 10)
						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], 28)
						doSendMagicEffect(getCreaturePosition(cid), 61)
						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


and in action.xml
Code:
      <action actionid="56501-56504" event="script" value="other/casino.lua" />

now you have the casino script good luck
 
Last edited:
Back
Top