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

Receive random mount

Nightimarez

New Member
Joined
Jul 24, 2008
Messages
287
Reaction score
2
I need this script fixed.

PHP:
function onUse(cid, item, frompos, item2, topos)
local prize = {392, 421, 426, 437, 438}
 
if getPlayerStorageValue(cid, 9998) == -1 then
local randomChance = math.random(1, 5)
doPlayerAddMount(cid, prize[randomChance], 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
			end
        return TRUE
end

This is the error I get.

PHP:
[22/11/2011 15:13:51] Lua Script Error: [Action Interface] 
[22/11/2011 15:13:51] data/actions/scripts/addons/roll horse.lua:onUse
[22/11/2011 15:13:51] luaDoPlayerAddMount(). Player not found
[22/11/2011 15:13:51] stack traceback:
[22/11/2011 15:13:51] 	[C]: in function 'doPlayerAddMount'
[22/11/2011 15:13:51] 	data/actions/scripts/addons/roll horse.lua:6: in function <data/actions/scripts/addons/roll horse.lua:1>
 
Last edited:
Try, not tested:
LUA:
function onUse(cid, item, fromPos, itemEx, toPos)
	doPlayerAddMount(cid, math.random(1, 26))
	return doRemoveItem(item.uid, 1)
end
 
LUA:
local c = {17, 22, 23, 24, 25}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if doRemoveItem(item.uid, 1) then
		return doPlayerAddMount(cid, c[math.random(#c)])
	end
end
 
Back
Top