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

Dice Script

3AsFoR

New Member
Joined
Jan 18, 2015
Messages
41
Reaction score
0
Location
Egypt
hey please i need script for dice work with talkaction by every number only dice not casino system i have this but not work fine and no action with numbers you understand me i made roll but didn't see the numbers!!!
where is the problem here !!??

function onUse(cid, item, fromPosition, itemEx, toPosition)
local value = math.random(5792, 5797)
if fromPosition.x ~= CONTAINER_POSITION then
doSendMagicEffect(fromPosition, CONST_ME_CRAPS)
end
doTransformItem(item.uid, value)
doCreatureSay(cid, getCreatureName(cid) .. ' rolled a ' .. value - 5791 .. '.', TALKTYPE_ORANGE_1)
return TRUE
end
 
hey please i need script for dice work with talkaction by every number only dice not casino system i have this but not work fine and no action with numbers you understand me i made roll but didn't see the numbers!!!
where is the problem here !!??

function onUse(cid, item, fromPosition, itemEx, toPosition)
local value = math.random(5792, 5797)
if fromPosition.x ~= CONTAINER_POSITION then
doSendMagicEffect(fromPosition, CONST_ME_CRAPS)
end
doTransformItem(item.uid, value)
doCreatureSay(cid, getCreatureName(cid) .. ' rolled a ' .. value - 5791 .. '.', TALKTYPE_ORANGE_1)
return TRUE
end
Please write which TFS you are using and use code tags.
:) So your post wont get deleted
 
my ot is 8.1 .xml
and i put this script in actions folder at dice.lua

and it work with me but i need to see numbers appear to me like munch when you eating !!!
 
Last edited by a moderator:
and i put this also at food.lua and get nothing dice make roll only without sound or talkaction by numbers

elseif item.itemid == 5792 then
nutrition = 5
text = "1"
elseif item.itemid == 5793 then
nutrition = 5
text = "2"
elseif item.itemid == 5794 then
nutrition = 5
text = "3"
elseif item.itemid == 5795 then
nutrition = 5
text = "4"
elseif item.itemid == 5796 then
nutrition = 5
text = "5"
elseif item.itemid == 5797 then
nutrition = 5
text = "6"
 
and i have this error
data/actions/scripts/dice.lua:7: attempt to call global 'doCreatureSay' (a nil v
alue)
could any one help me please !!!
 
Get rid of your changes in the food.
Try this.
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, false, pid)
     end
   end

   doTransformItem(item.uid, value)
   return true
end
 
Get rid of your changes in the food.
Try this.
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, false, pid)
     end
   end

   doTransformItem(item.uid, value)
   return true
end
------------------------------------------------------------------------------
i face this error dice rolling but didn't give me msg with numbers !!!

Lua Script Error: [Action Interface]
data/actions/scripts/dice.lua:eek:nUse

data/actions/scripts/dice.lua:7: attempt to call global 'getThingPosition' (a ni
l value)
 
Look if you have the sources of your server, in luascript.cpp you can find the functions you can use.
It's probable called getThingPos in your server.
 
Back
Top