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

Auto Stock script

rcb chief

New Member
Joined
Dec 23, 2008
Messages
53
Reaction score
0
I was wondering if there is any way that if there is anyway for a certain item to autostock once its in you backpack.. say you have 45 coin and pickup 13 coins and put it anywhere in your backpack they stock and only occupy one slot with 58 coins.

I want it for my casino tokens just a little help and i can finish it. thanks :)
 
are you adding the tokens in a script?.. you could do something like

x = player tokens
remove x tokens from player
new number = x + number of tokens your adding
add new number of tokens to player

that should autostack it since you adding all the tokens in a stack.. like if the guy had 30 tokens, and just won 20 it would remove the 30 tokens then give him a stack of 50
 
i have a script these script

function onUse(cid, item, frompos, item2, topos)

-- Configuracion

local chance1 = math.random(1,12) -- 10% posibidad de ganar el item
local ficha = 2157 -- ficha q usaremos
local effect = 26 --los efectos
local effect2 = 29
local effect3 = 28
local effect4 = 30

-- Final de configuracion

if item2.itemid == 9889 then
if (doPlayerRemoveItem (cid,ficha,1) ) then
if chance1 == 1 then
doSendMagicEffect(topos,effect2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 1.')
doPlayerAddItem(cid, ficha, 2)
elseif chance1 == 2 then
doSendMagicEffect(topos,effect3)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 3.')
doPlayerAddItem(cid, ficha, 4)
elseif chance1 == 3 then
doSendMagicEffect(topos,effect)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 5.')
doPlayerAddItem(cid, ficha, 6)
elseif chance1 >= 4 then
doSendMagicEffect(topos,effect)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Lose.')
end
else
doPlayerSendCancel(cid, "You need 1 token to play.")
end
elseif item2.itemid == 9892 then
if (doPlayerRemoveItem (cid,ficha,1) ) then
if chance1 == 1 then
doSendMagicEffect(topos,effect2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 1.')
doPlayerAddItem(cid, ficha, 2)
elseif chance1 == 2 then
doSendMagicEffect(topos,effect3)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 3.')
doPlayerAddItem(cid, ficha, 4)
elseif chance1 == 3 then
doSendMagicEffect(topos,effect)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 5.')
doPlayerAddItem(cid, ficha, 6)
elseif chance1 >= 4 then
doSendMagicEffect(topos,effect)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Lose.')
end
else
doPlayerSendCancel(cid, "You need 1 token to play.")
end
end
end

what do you suggest i do? =/
 
let me know if this works
EDIT try this one
Code:
function onUse(cid, item, frompos, item2, topos)

-- Configuracion

local chance1 = math.random(1,12) -- 10% posibidad de ganar el item
local ficha = 2157 -- ficha q usaremos
local effect = 26 --los efectos
local effect2 = 29
local effect3 = 28
local effect4 = 30
local number = getPlayerItemCount(cid, ficha)
-- Final de configuracion

if item2.itemid == 9889 then
	if (doPlayerRemoveItem (cid,ficha,1) ) then
		if chance1 == 1 then
			doSendMagicEffect(topos,effect2)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 1.')
			doPlayerRemoveItem(cid,ficha,number-1)
			doPlayerAddItem(cid, ficha, number+1)
		elseif chance1 == 2 then
			doSendMagicEffect(topos,effect3)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 3.')
			doPlayerRemoveItem(cid,ficha,number-1)
			doPlayerAddItem(cid, ficha, number+3)
		elseif chance1 == 3 then
			doSendMagicEffect(topos,effect)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 5.')
			doPlayerRemoveItem(cid,ficha,number-1)
			doPlayerAddItem(cid, ficha, number+5)
		elseif chance1 >= 4 then
			doSendMagicEffect(topos,effect)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Lose.')
			doPlayerRemoveItem(cid,ficha,1)
		end
	else
		doPlayerSendCancel(cid, "You need 1 token to play.") 
	end
elseif item2.itemid == 9892 then
	if (doPlayerRemoveItem (cid,ficha,1) ) then
		if chance1 == 1 then
			doSendMagicEffect(topos,effect2)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 1.')
			doPlayerRemoveItem(cid,ficha,number-1)
			doPlayerAddItem(cid, ficha, number+1)
		elseif chance1 == 2 then
			doSendMagicEffect(topos,effect3)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 3.')
			doPlayerRemoveItem(cid,ficha,number-1)
			doPlayerAddItem(cid, ficha, number+3)
		elseif chance1 == 3 then
			doSendMagicEffect(topos,effect)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Win 5.')
			doPlayerRemoveItem(cid,ficha,number-1)
			doPlayerAddItem(cid, ficha, number+5)
		elseif chance1 >= 4 then
			doSendMagicEffect(topos,effect)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You insert the token and Lose.')
		end
	else
		doPlayerSendCancel(cid, "You need 1 token to play.") 
	end
end

end
 
Back
Top