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

2 requests ?

breadmaker

New Member
Joined
Jul 16, 2010
Messages
160
Reaction score
3
Hello i have a request!


1)
If i click on item id: 9850 (custom made for my OT project Mystic box)

The item will destroy (dissapear) and:
We got math.random item from 10 items or we got 10% chances to get nothing.

2)
Same as first one but we got math.random 5-10 meat from box and 10% chances to get nothing.



Anyone can make it ?
Please.
Rep+++
 
First.

Code:
local items = {
	[1] = 0000,
	[2] = 1111,
	[3] = 2222,
	[4] = 3333,
	[4] = 4444
	}

function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = getThingPos(cid)
	doPlayerRemoveItem(cid,9850,1)
	if math.random(1,100) =< 90 then
		for i = 1,10 do
			local t = math.random(items[i])
			doPlayerAddItem(cid,math.random(t),1)
			doSendMagicEffect(v,math.random(11,18))
		end
		doPlayerSendTextMessage(cid,27,'You got lucky!')
		
	else
		doPlayerSendTextMessage(cid,27,'You lost your item.')
		doSendMagicEffect(v,2)
	end
	return true
end

second.

Code:
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = getThingPos(cid)
	if math.random(1,100) =< 90 then
		for i = 1,10 do
				if math.random(1,10) =< 7 then --70% chance to get meat
					doPlayerAddItem(cid,[b]ITEM_ID_OF_MEAT[/b],1)
				end
			doSendMagicEffect(v,math.random(11,18)
		end
		doPlayerSendTextMessage(cid,27,'You got lucky!')
	else
		doPlayerSendTextMessage(cid,27,'You didn\'t get anything.')
		doSendMagicEffect(v,2)
	end
	return true
end
 
Last edited:
ehm.. the signs are wrong :)
LUA:
local items = {
	[1] = 0000,
	[2] = 1111,
	[3] = 2222,
	[4] = 3333,
	[4] = 4444
	}

function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = getThingPos(cid)
	doPlayerRemoveItem(cid,9850,1)
	if math.random(1,100) <= 90 then
		for i = 1,10 do
			local t = math.random(items[i])
			doPlayerAddItem(cid,math.random(t),1)
			doSendMagicEffect(v,math.random(11,18))
		end
		doPlayerSendTextMessage(cid,27,'You got lucky!')
		
	else
		doPlayerSendTextMessage(cid,27,'You lost your item.')
		doSendMagicEffect(v,2)
	end
	return true
end
LUA:
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = getThingPos(cid)
	if math.random(1,100) <= 90 then
		for i = 1,10 do
				if math.random(1,10) <= 7 then --70% chance to get meat
					doPlayerAddItem(cid,ITEM_ID_OF_MEAT,1)
				end
			doSendMagicEffect(v,math.random(11,18)
		end
		doPlayerSendTextMessage(cid,27,'You got lucky!')
	else
		doPlayerSendTextMessage(cid,27,'You didn\'t get anything.')
		doSendMagicEffect(v,2)
	end
	return true
end
 
NExt errors, breadmaker = my brother :( :
PHP:
[09/08/2010 19:46:08] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/boxy/box1.lua)
[09/08/2010 19:46:08] data/actions/scripts/boxy/box1.lua:9: ')' expected (to close '(' at line 8) near 'end'

Box1.lua
PHP:
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = getThingPos(cid)
        if math.random(1,100) <= 90 then
                for i = 1,10 do
                                if math.random(1,10) <= 7 then --70% chance to get meat
                                        doPlayerAddItem(cid,2160,math.random(1,30))
                                end
                        doSendMagicEffect(v,math.random(85,87)
                end
                doPlayerSendTextMessage(cid,27,'You got lucky!')
        else
                doPlayerSendTextMessage(cid,27,'You didn\'t get anything.')
                doSendMagicEffect(v,2)
        end
        return true
end
 
LUA:
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = getThingPos(cid)
        if math.random(1,100) <= 90 then
                for i = 1,10 do
                                if math.random(1,10) <= 7 then --70% chance to get meat
                                        doPlayerAddItem(cid,2160,math.random(1,30))
                                end
                        doSendMagicEffect(v,math.random(85,87))
                end
                doPlayerSendTextMessage(cid,27,'You got lucky!')
        else
                doPlayerSendTextMessage(cid,27,'You didn\'t get anything.')
                doSendMagicEffect(v,2)
        end
        return true
end
 
Back
Top