• 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 Help to fix this script

Tul

New Member
Joined
Apr 19, 2011
Messages
60
Reaction score
0
who can fix this script when a player have item 2345 he can summon this pet but dont remove the item

PHP:
local d,l,g,m,s = 'pet one'
function onSay(cid,words,param)
local v = getThingPos(cid)
    if getPlayerStorageValue(cid,s) ~= 1 then
        if not getTilePzInfo(v) then
            if getPlayerLevel(cid) >= l then
if item.itemid == 2345 then
                    setPlayerStorageValue(cid,s,1)
                    doSummonMonster(cid,d:lower())
                    doSendMagicEffect(v,12)
                    doPlayerSendTextMessage(cid,27,'You summoned a '..d..'.')
                else
                    doPlayerSendCancel(cid,'Not enough gold, need '..g..' gold.')
                    doSendMagicEffect(v,2)
                end
            else
            local n = l - getPlayerLevel(cid)
                doPlayerSendCancel(cid,'You need '..n..' levels more to summon this.')
                doSendMagicEffect(v,2)
            end
        else
            doPlayerSendCancel(cid,'Not allowed in PZ.')
            doSendMagicEffect(v,2)
        end
    else
        for _,c in ipairs(getCreatureSummons(cid)) do
            doSendMagicEffect(getThingPos(c),2)
            doRemoveCreature(c)
        end
        setPlayerStorageValue(cid,s,0)
        doPlayerSendTextMessage(cid,27,d..' is called back.')
    end
    return true
end

rep++
 
i dont know where it belongs but I've also done purely in actions is not there and I have no error in conlose, and does not work
 
i get this error when its in actions:
PHP:
[21/04/2011 10:29:26] [Warning - Event::loadScript] Event onUse not found (data/actions/scripts/petsspecial.lua)

actions.xml
PHP:
 	<action itemid="2345" script="petsspecial.lua" />

petsspecial.lua
PHP:
local d,l,g,m,s = 'pet special',8,1,'crystal coin',13812 -- change 'gold coin' to whatever coin you want.
function onSay(cid,words,param)
local v = getThingPos(cid)
    if getPlayerStorageValue(cid,s) ~= 1 then
        if not getTilePzInfo(v) then
            if getPlayerLevel(cid) >= l then
                if doPlayerRemoveItem(cid,getItemIdByName(m:lower()),g) then
                    setPlayerStorageValue(cid,s,1)
                    doSummonMonster(cid,d:lower())
                    doSendMagicEffect(v,12)
                    doPlayerSendTextMessage(cid,27,'You summoned a '..d..'.')
                else
                    doPlayerSendCancel(cid,'Not enough gold, need '..g..' crystal coins.')
                    doSendMagicEffect(v,2)
                end
            else
            local n = l - getPlayerLevel(cid)
                doPlayerSendCancel(cid,'You need '..n..' levels more to summon this.')
                doSendMagicEffect(v,2)
            end
        else
            doPlayerSendCancel(cid,'Not allowed in PZ.')
            doSendMagicEffect(v,2)
        end
    else
        for _,c in ipairs(getCreatureSummons(cid)) do
            doSendMagicEffect(getThingPos(c),2)
            doRemoveCreature(c)
        end
        setPlayerStorageValue(cid,s,0)
        doPlayerSendTextMessage(cid,27,d..' is called back.')
    end
    return true
end
 
Why do you put this to Action folder if it the function is onSay?

try to put that into the talkaction folder....
 
ehm ok its work but i dont want that the item remove on use!

PHP:
	<talkaction words="!special" script="petsspecial.lua" />

PHP:
local d,l,g,m,s = 'pet special',8,1,'spy report',13812 -- change 'gold coin' to whatever coin you want.
function onSay(cid,words,param)
local v = getThingPos(cid)
    if getPlayerStorageValue(cid,s) ~= 1 then
        if not getTilePzInfo(v) then
            if getPlayerLevel(cid) >= l then
                if doPlayerRemoveItem(cid,getItemIdByName(m:lower()),g) then
                    setPlayerStorageValue(cid,s,1)
                    doSummonMonster(cid,d:lower())
                    doSendMagicEffect(v,12)
                    doPlayerSendTextMessage(cid,27,'You summoned a '..d..'.')
                else
                    doPlayerSendCancel(cid,'Not enough gold, need '..g..' crystal coins.')
                    doSendMagicEffect(v,2)
                end
            else
            local n = l - getPlayerLevel(cid)
                doPlayerSendCancel(cid,'You need '..n..' levels more to summon this.')
                doSendMagicEffect(v,2)
            end
        else
            doPlayerSendCancel(cid,'Not allowed in PZ.')
            doSendMagicEffect(v,2)
        end
    else
        for _,c in ipairs(getCreatureSummons(cid)) do
            doSendMagicEffect(getThingPos(c),2)
            doRemoveCreature(c)
        end
        setPlayerStorageValue(cid,s,0)
        doPlayerSendTextMessage(cid,27,d..' is called back.')
    end
    return true
end
 
Last edited:
i really suck at scripting.............. BUT you can try this


LUA:
local d,l,g,m,s = 'pet special',8,1,'spy report',13812 -- change 'gold coin' to whatever coin you want. 
function onSay(cid,words,param) 
local v = getThingPos(cid) 
    if getPlayerStorageValue(cid,s) ~= 1 then 
        if not getTilePzInfo(v) then 
            if getPlayerLevel(cid) >= l then 
                  setPlayerStorageValue(cid,s,1)
                    doSummonMonster(cid,d:lower()) 
                    doSendMagicEffect(v,12) 
                    doPlayerSendTextMessage(cid,27,'You summoned a '..d..'.') 
                else 
                    doPlayerSendCancel(cid,'Not enough gold, need '..g..' crystal coins.') 
                    doSendMagicEffect(v,2) 
                end 
            else 
            local n = l - getPlayerLevel(cid) 
                doPlayerSendCancel(cid,'You need '..n..' levels more to summon this.') 
                doSendMagicEffect(v,2) 
            end 
        else 
            doPlayerSendCancel(cid,'Not allowed in PZ.') 
            doSendMagicEffect(v,2) 
        end 
    else 
        for _,c in ipairs(getCreatureSummons(cid)) do 
            doSendMagicEffect(getThingPos(c),2) 
            doRemoveCreature(c) 
        end 
        setPlayerStorageValue(cid,s,0) 
        doPlayerSendTextMessage(cid,27,d..' is called back.') 
    end 
    return true 
end
 
milice i dk what do you mean, i changed
PHP:
 if doPlayerRemoveItem(cid,getItemIdByName(m:lower()),g) then
to
PHP:
if(doPlayerRemoveItem(cid, 2345, 100) then
but i get error

plx help fast
 
:facepalm:

you got this line:

if item.itemid == 2345 then

change that to if(doPlayerRemoveItem(cid, 2345, 100) then

cuz talkactions dont have a item check function i think
 
i dont have it i have only
PHP:
local d,l,g,m,s = 'pet special',8,1,'spy report',13812 -- change 'gold coin' to whatever coin you want.

maybe you can add it to the script and write it here. THX !
 
Code:
local d,l,g,m,s = 'pet one' 
function onSay(cid,words,param) 
local v = getThingPos(cid) 
    if getPlayerStorageValue(cid,s) ~= 1 then 
        if not getTilePzInfo(v) then 
            if getPlayerLevel(cid) >= l then 
if item.itemid == 2345 then                         --- THIS IS THE GOD DAMNED LINE I MENT -.-'
                    setPlayerStorageValue(cid,s,1) 
                    doSummonMonster(cid,d:lower()) 
                    doSendMagicEffect(v,12) 
                    doPlayerSendTextMessage(cid,27,'You summoned a '..d..'.') 
                else 
                    doPlayerSendCancel(cid,'Not enough gold, need '..g..' gold.') 
                    doSendMagicEffect(v,2) 
                end 
            else 
            local n = l - getPlayerLevel(cid) 
                doPlayerSendCancel(cid,'You need '..n..' levels more to summon this.')
                doSendMagicEffect(v,2) 
            end 
        else 
            doPlayerSendCancel(cid,'Not allowed in PZ.') 
            doSendMagicEffect(v,2) 
        end 
    else 
        for _,c in ipairs(getCreatureSummons(cid)) do 
            doSendMagicEffect(getThingPos(c),2) 
            doRemoveCreature(c) 
        end 
        setPlayerStorageValue(cid,s,0) 
        doPlayerSendTextMessage(cid,27,d..' is called back.') 
    end 
    return true 
end
 
Code:
local d,l,s = 'pet special',8,13812 -- change 'gold coin' to whatever coin you want.
function onSay(cid,words,param)
local v = getThingPos(cid)
    if getPlayerStorageValue(cid,s) ~= 1 then
        if not getTilePzInfo(v) then
            if getPlayerLevel(cid) >= l then
                    setPlayerStorageValue(cid,s,1)
                    doSummonMonster(cid,d:lower())
                    doSendMagicEffect(v,12)
                    doPlayerSendTextMessage(cid,27,'You summoned a '..d..'.')
            else
            local n = l - getPlayerLevel(cid)
                doPlayerSendCancel(cid,'You need '..n..' levels more to summon this.')
                doSendMagicEffect(v,2)
            end
        else
            doPlayerSendCancel(cid,'Not allowed in PZ.')
            doSendMagicEffect(v,2)
        end
    else
        for _,c in ipairs(getCreatureSummons(cid)) do
            doSendMagicEffect(getThingPos(c),2)
            doRemoveCreature(c)
        end
        setPlayerStorageValue(cid,s,0)
        doPlayerSendTextMessage(cid,27,d..' is called back.')
    end
    return true
end

rep+ me if works ;)
 
Back
Top