• 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 Taming System

It's not coded the best or most optimal way, but it should work for you.

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerMount(cid, 13) then
        doCreatureSay(cid, "You have already tamed a donkey.", TALKTYPE_ORANGE_1)
        return true
    end

    if getCreatureName(itemEx.uid):lower() == "donkey" then
        local chance = math.random(1, 100)
        if chance <= 50 then -- 1-50
            doCreatureSay(cid, "You did not manage to feed the donkey enough apple slices.", TALKTYPE_ORANGE_1)
        elseif chance > 51 and chance <= 85 then -- 51-85
            doCreatureSay(cid, "The donkey ran away.", TALKTYPE_ORANGE_1)
            doSendMagicEffect(getCreaturePosition(itemEx.uid), CONST_ME_POFF)
            doRemoveCreature(itemEx.uid)
        elseif chance > 85 and chance <= 90 then -- 86-90
            doCreatureSay(cid, "Oh no! The donkey ate all of the apple slices.", TALKTYPE_ORANGE_1)
            doSendMagicEffect(getCreaturePosition(cid), CONST_ME_BLOCKHIT)
            doRemoveItem(item.uid, 1)
        else -- 91-100
            setPlayerStorageValue(cid, item.itemid, 1) 
            doPlayerAddMount(cid, 13)
            doCreatureSay(cid, "Munching a large pile of apple slices tamed the donkey.", TALKTYPE_ORANGE_1)
            doSendMagicEffect(getCreaturePosition(itemEx.uid), CONST_ME_POFF)
            doRemoveItem(item.uid, 1)
            doRemoveCreature(itemEx.uid)
        end
    end
    return true
end

Red
 
Back
Top