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

[Request] Dice script/item for OTHire

tarantonio

Old School Player
Joined
Jun 21, 2009
Messages
865
Solutions
1
Reaction score
274
I'm looking to make dice available on 7.6 server.
I have this code for dice, but I need to transform it to work on OTHire (otserv):
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local dicePosition = item:getPosition()
    local value = math.random(6)
    local isInGhostMode = player:isInGhostMode()

    dicePosition:sendMagicEffect(CONST_ME_CRAPS, isInGhostMode and player)

    local spectators = Game.getSpectators(dicePosition, false, true, 3, 3)
    for _, pid in ipairs(spectators) do
        player:say(player:getName() .. " rolled a " .. value .. ".", TALKTYPE_MONSTER_SAY, isInGhostMode, pid, dicePosition)
    end

    item:transform(5791 + value)
    return true
end
Also if anyone knows how to make the item available on client/server please help me. I know that I have to modify something, but I'm lost now.
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(fromPosition.x ~= CONTAINER_POSITION) then
doSendMagicEffect(fromPosition, CONST_ME_CRAPS)
end
local value = math.random(5792, 5797)
for i, pid in ipairs(getSpectators(getThingPosition(item.uid), 3, 3)) do
if(isPlayer(pid)) then
doCreatureSay(cid, getCreatureName(cid) .. ' rolled a ' .. value - 5791 .. '.', TALKTYPE_MONSTER)
end
end
doTransformItem(item.uid, value)
return true
end

You just need to change the IDs and the Magic Effect, simple ;)
 
Back
Top