• 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 [REQUEST] Soft refill talkaction

Luka Trklja

Member
Joined
Jul 8, 2016
Messages
121
Solutions
5
Reaction score
8
Location
Croatia
Struggling with the refill talkaction, could anyone make one for me?
Currently all I have is this, not sure how correct that is, still new and learning :)

TFS 0.3.6 8.6

Lua:
local config = {
soft = 6132,
worn = 10021
}


function onSay(cid, words, param)

    if doPlayerRemoveItem(cid, config.worn, 1)) == TRUE then doPlayerAddItem(cid, config.soft, 1) and doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You recharged your soft boots!")
  
    else
  
    doPlayerSendCancel(cid, "You dont have soft boots!"
    end
end

And this is the error I get
Code:
[Error - LuaScriptInterface::loadFile] data/talkactions/scripts/softboots.lua:45: 'then' expected near ')'
[Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/softboots.lua)
data/talkactions/scripts/softboots.lua:45: 'then' expected near ')'
 
Solution
Try this

Lua:
local config = {
    soft = 6132,
    worn = 10021
}

function onSay(cid, words, param)
    if (doPlayerRemoveItem(cid, config.worn, 1) == TRUE and doPlayerAddItem(cid, config.soft, 1)) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You recharged your soft boots!")
    else
        doPlayerSendCancel(cid, "You dont have soft boots!")
    end
end
Try this

Lua:
local config = {
    soft = 6132,
    worn = 10021
}

function onSay(cid, words, param)
    if (doPlayerRemoveItem(cid, config.worn, 1) == TRUE and doPlayerAddItem(cid, config.soft, 1)) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You recharged your soft boots!")
    else
        doPlayerSendCancel(cid, "You dont have soft boots!")
    end
end
 
Solution
Try this

Lua:
local config = {
    soft = 6132,
    worn = 10021
}

function onSay(cid, words, param)
    if (doPlayerRemoveItem(cid, config.worn, 1) == TRUE and doPlayerAddItem(cid, config.soft, 1)) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You recharged your soft boots!")
    else
        doPlayerSendCancel(cid, "You dont have soft boots!")
    end
end
That works, thank you very much!
 
Back
Top