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

Solved More Places

Mera Mero

Guess Who?
Joined
Dec 27, 2014
Messages
417
Reaction score
86
Hello otlanders ,i have got casino mod ,my problem is how can i add more places with this? cuz there is one place only and when i tried to put comma gave me many errors
@Flatlander
@Limos
Code:
<?xml version="1.0" encoding="utf-8"?>
<mod name="Casino lever2" enabled="yes">
  <action uniqueid="5889" event="script"><![CDATA[
        local pos = {x=932, y=818, z=8, stackpos = 255}
    
        local cash = 2160
        local t = {
        [{1, 70}] = 0,
        [{71, 90}] = 2,
        [{91, 100}] = 3
    }
        local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

        function onUse(cid, item, fromPosition, itemEx, toPosition)
            local v = getThingfromPos(pos)
            if v.itemid ~= cash then
                return doCreatureSay(cid, 'Only ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
            end

            local r = math.random(100)
            for i, k in pairs(t) do
                if r >= i[1] and r <= i[2] then
                    doRemoveItem(v.uid)
                    if k < 1 then
                        doCreatureSay(cid, 'You Lost ' .. v.type .. ' ' .. (v.type == 1 and a or b) .. ' :(', TALKTYPE_ORANGE_1, false, cid)
                        doSendMagicEffect(pos, CONST_ME_POFF)
                    else
                        doCreatureSay(cid, 'You Win ' .. v.type * k .. ' ' .. (v.type == 1 and a or b) .. ' :)', TALKTYPE_ORANGE_1, false, cid)
                        doCreateItem(cash, v.type * k, pos)
                        doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(toPosition, CONST_ME_SOUND_YELLOW)
                    end
                    return true
                end
            end
        end
    ]]></action>
</mod>
 
Last edited:
You can do the positions based on uniqueid.
Code:
local pos = {
   [5889] = {x=932, y=818, z=8, stackpos = 255},
   [5890] = {x=934, y=818, z=8, stackpos = 255},
   [5891] = {x=938, y=818, z=8, stackpos = 255}
}
Code:
local v = getThingfromPos(pos[item.uid])
 
You can do the positions based on uniqueid.
Code:
local pos = {
   [5889] = {x=932, y=818, z=8, stackpos = 255},
   [5890] = {x=934, y=818, z=8, stackpos = 255},
   [5891] = {x=938, y=818, z=8, stackpos = 255}
}
Code:
local v = getThingfromPos(pos[item.uid])
hmm only UNIQ 5889 worked and other ones ,doesn't work and when i tried to play with UID 5889 and won cash couldn't find it on my backpack or anywhere o_O
Code:
<?xml version="1.0" encoding="utf-8"?>
<mod name="Casino lever2" enabled="yes">
<action uniqueid="5889" event="script"><![CDATA[
   local pos = {
   [5889] = {x=1024, y=1026, z=7, stackpos = 255},
   [5890] = {x=1026, y=1026, z=7, stackpos = 255},
   [5891] = {x=1028, y=1026, z=7, stackpos = 255}
}
    
        local cash = 2160
        local t = {
        [{1, 70}] = 0,
        [{71, 90}] = 2,
        [{91, 100}] = 3
    }
        local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

        function onUse(cid, item, fromPosition, itemEx, toPosition)
            local v = getThingfromPos(pos[item.uid])
            if v.itemid ~= cash then
                return doCreatureSay(cid, 'Only ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
            end

            local r = math.random(100)
            for i, k in pairs(t) do
                if r >= i[1] and r <= i[2] then
                    doRemoveItem(v.uid)
                    if k < 1 then
                        doCreatureSay(cid, 'You Lost ' .. v.type .. ' ' .. (v.type == 1 and a or b) .. ' :(', TALKTYPE_ORANGE_1, false, cid)
                        doSendMagicEffect(pos, CONST_ME_POFF)
                    else
                        doCreatureSay(cid, 'You Win ' .. v.type * k .. ' ' .. (v.type == 1 and a or b) .. ' :)', TALKTYPE_ORANGE_1, false, cid)
                        doCreateItem(cash, v.type * k, pos)
                        doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(toPosition, CONST_ME_SOUND_YELLOW)
                    end
                    return true
                end
            end
        end
    ]]></action>
</mod>
and got this error when i win some
Code:
[10/02/2015 21:08:02] [Error - Action Interface]
[10/02/2015 21:08:02] buffer:onUse
[10/02/2015 21:08:02] Description:
[10/02/2015 21:08:02] (luaDoCreateItem) Tile not found
 
like this?
Code:
<?xml version="1.0" encoding="utf-8"?>
<mod name="Casino lever2" enabled="yes">
<action uniqueid="5889" event="script">
<action uniqueid="5890" event="script">
<action uniqueid="5891" event="script"><![CDATA[
   local pos = {
   [5889] = {x=1024, y=1026, z=7, stackpos = 255},
   [5890] = {x=1026, y=1026, z=7, stackpos = 255},
   [5891] = {x=1028, y=1026, z=7, stackpos = 255}
}
     
        local cash = 2160
        local t = {
        [{1, 70}] = 0,
        [{71, 90}] = 2,
        [{91, 100}] = 3
    }
        local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

        function onUse(cid, item, fromPosition, itemEx, toPosition)
            local v = getThingfromPos(pos[item.uid])
            if v.itemid ~= cash then
                return doCreatureSay(cid, 'Only ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
            end

            local r = math.random(100)
            for i, k in pairs(t) do
                if r >= i[1] and r <= i[2] then
                    doRemoveItem(v.uid)
                    if k < 1 then
                        doCreatureSay(cid, 'You Lost ' .. v.type .. ' ' .. (v.type == 1 and a or b) .. ' :(', TALKTYPE_ORANGE_1, false, cid)
                        doSendMagicEffect(pos, CONST_ME_POFF)
                    else
                        doCreatureSay(cid, 'You Win ' .. v.type * k .. ' ' .. (v.type == 1 and a or b) .. ' :)', TALKTYPE_ORANGE_1, false, cid)
                        doCreateItem(cash, v.type * k, pos)
                        doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(toPosition, CONST_ME_SOUND_YELLOW)
                    end
                    return true
                end
            end
        end
    ]]></action>
</mod>
doesn't work :S sorry
 
Without the mod parts, add the lines for the uniqueids in actions.xml, not in the lua script.
sorry for posting here will delete post in 10 min.. Check ur inbox Limos and i will pay u if u help me! :) I guess it even wont take long for u.. couple of minutes...
 
Without the mod parts, add the lines for the uniqueids in actions.xml, not in the lua script.
[10/02/2015 21:26:11] [Warning - BaseEvents::loadFromXml] Cannot open actions.xml file.
[10/02/2015 21:26:11] Line: 718, Info: Premature end of data in tag actions line 2
when i added on action.xml
<action uniqueid="5890" event="script">
<action uniqueid="5891" event="script">
 
Add
Code:
<action uniqueid="5889" event="script">
<action uniqueid="5890" event="script">
<action uniqueid="5891" event="script">
In Actions.XML not in .LUA
 
[10/02/2015 21:26:11] [Warning - BaseEvents::loadFromXml] Cannot open actions.xml file.
[10/02/2015 21:26:11] Line: 718, Info: Premature end of data in tag actions line 2
when i added on action.xml
<action uniqueid="5890" event="script">
<action uniqueid="5891" event="script">
Post ur whole XML..
 
In actions.xml add:
Code:
<action uniqueid="5889" script="casino.lua"/>
<action uniqueid="5890" script="casino.lua"/>
<action uniqueid="5891" script="casino.lua"/>

Create a new file in data/actions/scripts and name it casino.lua, then paste this:
Code:
local pos = {
   [5889] = {x=1024, y=1026, z=7, stackpos = 255},
   [5890] = {x=1026, y=1026, z=7, stackpos = 255},
   [5891] = {x=1028, y=1026, z=7, stackpos = 255}
}
    
local cash = 2160
local t = {
    [{1, 70}] = 0,
    [{71, 90}] = 2,
    [{91, 100}] = 3
}

local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local v = getThingfromPos(pos[item.uid])
    if v.itemid ~= cash then
        return doCreatureSay(cid, 'Only ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
    end

    local r = math.random(100)
    for i, k in pairs(t) do
        if r >= i[1] and r <= i[2] then
            doRemoveItem(v.uid)
            if k < 1 then
                doCreatureSay(cid, 'You Lost ' .. v.type .. ' ' .. (v.type == 1 and a or b) .. ' :(', TALKTYPE_ORANGE_1, false, cid)
                doSendMagicEffect(pos, CONST_ME_POFF)
            else
                doCreatureSay(cid, 'You Win ' .. v.type * k .. ' ' .. (v.type == 1 and a or b) .. ' :)', TALKTYPE_ORANGE_1, false, cid)
                doCreateItem(cash, v.type * k, pos)
                doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
                doSendMagicEffect(toPosition, CONST_ME_SOUND_YELLOW)
            end
            return true
        end
    end
end

Edit: I just assumed the syntax for actions.xml was the same as in 1.x, so it's possible you need to change it to what @Ahilphino said below.
 
It's funny how you were insulting that other guy that requested scripts yet everyday you make requests of really simple stuff that you should've understand already. Anyways:
in actions.xml put this:
Code:
<action uniqueid="5889" event="script" value="other/casino.lua"/>
    <action uniqueid="5890" event="script" value="other/casino.lua"/>
    <action uniqueid="5891" event="script" value="other/casino.lua"/>

then inside actions/other make a file called casino.lua and put:
Code:
local pos = {
[5889] = {x=1024, y=1026, z=7, stackpos = 255},
[5890] = {x=1026, y=1026, z=7, stackpos = 255},
[5891] = {x=1028, y=1026, z=7, stackpos = 255}
}

local cash = 2160
local t = {
[{1, 70}] = 0,
[{71, 90}] = 2,
[{91, 100}] = 3
}
local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = getThingfromPos(pos[item.uid])
if v.itemid ~= cash then
return doCreatureSay(cid, 'Only ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
end

local r = math.random(100)
for i, k in pairs(t) do
if r >= i[1] and r <= i[2] then
doRemoveItem(v.uid)
if k < 1 then
doCreatureSay(cid, 'You Lost ' .. v.type .. ' ' .. (v.type == 1 and a or b) .. ' :(', TALKTYPE_ORANGE_1, false, cid)
doSendMagicEffect(pos, CONST_ME_POFF)
else
doCreatureSay(cid, 'You Win ' .. v.type * k .. ' ' .. (v.type == 1 and a or b) .. ' :)', TALKTYPE_ORANGE_1, false, cid)
doCreateItem(cash, v.type * k, pos)
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
doSendMagicEffect(toPosition, CONST_ME_SOUND_YELLOW)
end
return true
end
end
end

edit: too late :c
 
You have to add the lua script in the actions.xml line aswell, just add it like other actions.xml lines, with different uniqueid and different lua script.

Edit: @ up, we all posted at the same time :p
Well basicly same thing, but with TFS 0.3.6 you have to use event and value like Ahilphino posted.
 
Last edited:
It's funny how you were insulting that other guy that requested scripts yet everyday you make requests of really simple stuff that you should've understand already. Anyways:
in actions.xml put this:
Code:
<action uniqueid="5889" event="script" value="other/casino.lua"/>
    <action uniqueid="5890" event="script" value="other/casino.lua"/>
    <action uniqueid="5891" event="script" value="other/casino.lua"/>

then inside actions/other make a file called casino.lua and put:
Code:
local pos = {
[5889] = {x=1024, y=1026, z=7, stackpos = 255},
[5890] = {x=1026, y=1026, z=7, stackpos = 255},
[5891] = {x=1028, y=1026, z=7, stackpos = 255}
}

local cash = 2160
local t = {
[{1, 70}] = 0,
[{71, 90}] = 2,
[{91, 100}] = 3
}
local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = getThingfromPos(pos[item.uid])
if v.itemid ~= cash then
return doCreatureSay(cid, 'Only ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
end

local r = math.random(100)
for i, k in pairs(t) do
if r >= i[1] and r <= i[2] then
doRemoveItem(v.uid)
if k < 1 then
doCreatureSay(cid, 'You Lost ' .. v.type .. ' ' .. (v.type == 1 and a or b) .. ' :(', TALKTYPE_ORANGE_1, false, cid)
doSendMagicEffect(pos, CONST_ME_POFF)
else
doCreatureSay(cid, 'You Win ' .. v.type * k .. ' ' .. (v.type == 1 and a or b) .. ' :)', TALKTYPE_ORANGE_1, false, cid)
doCreateItem(cash, v.type * k, pos)
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
doSendMagicEffect(toPosition, CONST_ME_SOUND_YELLOW)
end
return true
end
end
end

edit: too late :c
hmm thanks its working with all but when i won cash i found this error
Code:
[10/02/2015 21:41:11] [Error - Action Interface]
[10/02/2015 21:41:11] data/actions/scripts/casino.lua:onUse
[10/02/2015 21:41:12] Description:
[10/02/2015 21:41:12] (luaDoCreateItem) Tile not found
 
Back
Top