• 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 Talkaction that needs permission to be used

juansanchez

Intermediate OT User
Joined
Apr 2, 2015
Messages
217
Reaction score
130
Hey guys, so, as the title says, i need help with a talkaction. I just got this !softboots talkactions (gets used soft, makes a new one), and i want players to first do a specific quest, to then be able to use the talkaction.
I know i have to use storages, but i'm just bad at scripting on lua. I tried doing it myself, but couldn't make it work, here is how i tried doing it:

function onSay(cid, words, param)
cost = 300000
pos = getPlayerPosition(cid)
if getPlayerStorageValue(cid, 281921) == 1 then
if getPlayerItemCount(cid, 10021) >= 1 then
if doPlayerRemoveMoney(cid,cost) == TRUE then
doSendMagicEffect(pos, 28)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Botas magicas recuperadas!")
doPlayerAddItem(cid, 6132, 1)
doPlayerRemoveItem(cid, 10021, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem dinheiro suficiente.")
doSendMagicEffect(pos, 2)

end
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem um par de botas magicas gastas para recuperar.")
doSendMagicEffect(pos, 2)

else
doPlayerSendCancel(cid, "Voce precisa completar a quest para usar este comando")
return false
end
end
end

I hope someone can help me out.
I'm using TFS 0.3.6. Thanks in advance if anyone is able to help.
 
Solution
Lua:
function onSay(cid, words, param)
    cost = 300000
    pos = getPlayerPosition(cid)
    if getPlayerStorageValue(cid, 281921) ~= 1 then
        doPlayerSendCancel(cid, "Voce precisa completar a quest para usar este comando")
        return false
    end
    if getPlayerItemCount(cid, 10021) >= 1 then
        if doPlayerRemoveMoney(cid,cost) == TRUE then
            doSendMagicEffect(pos, 28)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Botas magicas recuperadas!")
            doPlayerAddItem(cid, 6132, 1)
            doPlayerRemoveItem(cid, 10021, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem dinheiro suficiente.")
            doSendMagicEffect(pos, 2)
        end...
Lua:
function onSay(cid, words, param)
    cost = 300000
    pos = getPlayerPosition(cid)
    if getPlayerStorageValue(cid, 281921) ~= 1 then
        doPlayerSendCancel(cid, "Voce precisa completar a quest para usar este comando")
        return false
    end
    if getPlayerItemCount(cid, 10021) >= 1 then
        if doPlayerRemoveMoney(cid,cost) == TRUE then
            doSendMagicEffect(pos, 28)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Botas magicas recuperadas!")
            doPlayerAddItem(cid, 6132, 1)
            doPlayerRemoveItem(cid, 10021, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem dinheiro suficiente.")
            doSendMagicEffect(pos, 2)
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem um par de botas magicas gastas para recuperar.")
        doSendMagicEffect(pos, 2)
    end
end
 
Solution
Lua:
function onSay(cid, words, param)
    cost = 300000
    pos = getPlayerPosition(cid)
    if getPlayerStorageValue(cid, 281921) ~= 1 then
        doPlayerSendCancel(cid, "Voce precisa completar a quest para usar este comando")
        return false
    end
    if getPlayerItemCount(cid, 10021) >= 1 then
        if doPlayerRemoveMoney(cid,cost) == TRUE then
            doSendMagicEffect(pos, 28)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Botas magicas recuperadas!")
            doPlayerAddItem(cid, 6132, 1)
            doPlayerRemoveItem(cid, 10021, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem dinheiro suficiente.")
            doSendMagicEffect(pos, 2)
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Voce nao tem um par de botas magicas gastas para recuperar.")
        doSendMagicEffect(pos, 2)
    end
end

Yeeei, it worked! Thank you!!!
 

Similar threads

Replies
8
Views
1K
Evil Puncker
E
Back
Top