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

TFS 1.X+ Help in an action, add a mount but remove money.

wizinx

Active Member
Joined
Jul 6, 2010
Messages
211
Solutions
3
Reaction score
49
Location
Chile, Santiago
Hello everyone, I need help to finish the action, I need you to take money away from using the item and add the mount, could someone finish it? Thanks.


Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
        local mountId = {7, 8, 9}
            player:addMount(mountId[math.random(#mountId)])
            player:setStorageValue(11555, os.time() + 86400)
            player:sendTextMessage(MESSAGE_INFO_DESCR, "You received rented mount.")
            player:getPosition():sendMagicEffect(13)       
     return true
end
 
Solution
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local mountId = {7, 8, 9}
local money = 2000
    if player:removeMoney(money) then
        player:addMount(mountId[math.random(#mountId)])
        player:setStorageValue(11555, os.time() + 86400)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You received rented mount.")
        player:getPosition():sendMagicEffect(13)   
    else     
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You dont have enough money.")
    end
return true
end
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local mountId = {7, 8, 9}
local money = 2000
    if player:removeMoney(money) then
        player:addMount(mountId[math.random(#mountId)])
        player:setStorageValue(11555, os.time() + 86400)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You received rented mount.")
        player:getPosition():sendMagicEffect(13)   
    else     
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You dont have enough money.")
    end
return true
end
 
Solution
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local mountId = {7, 8, 9}
local money = 2000
    if player:removeMoney(money) then
        player:addMount(mountId[math.random(#mountId)])
        player:setStorageValue(11555, os.time() + 86400)
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You received rented mount.")
        player:getPosition():sendMagicEffect(13)  
    else    
        player:sendTextMessage(MESSAGE_INFO_DESCR, "You dont have enough money.")
    end
return true
end


thanks friend
 
Back
Top