• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

How to mount a player?

BobbyHawk

New Member
Joined
Mar 2, 2017
Messages
12
Reaction score
1
Hi Guys, I need help .. I would like to know if there is any command inside the server so I can give a mount to a player.
 
Tested on TFS 1.2
This command give all mounts to player, example: /mounts playerName

Code:
<talkaction words="/mounts" separator=" " script="allmounts.lua" />
Code:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    local target
    if param == '' then
        target = player:getTarget()
        if not target then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Unlocks all mounts for certain player. Usage: /mounts <player name>')
            return false
        end
    else
        target = Player(param)
    end

    if not target then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Player ' .. param .. ' is not currently online.')
        return false
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD  then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Cannot perform action.')
        return false
    end

    for i = 1, 90 do
        target:addMount(i)
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'All mounts unlocked for: ' .. target:getName())
    target:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '[Server] All mounts unlocked.')
    return false
end
 
Tested on TFS 1.2
This command give all mounts to player, example: /mounts playerName

Code:
<talkaction words="/mounts" separator=" " script="allmounts.lua" />
Code:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    local target
    if param == '' then
        target = player:getTarget()
        if not target then
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Unlocks all mounts for certain player. Usage: /mounts <player name>')
            return false
        end
    else
        target = Player(param)
    end

    if not target then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Player ' .. param .. ' is not currently online.')
        return false
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD  then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Cannot perform action.')
        return false
    end

    for i = 1, 90 do
        target:addMount(i)
    end

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'All mounts unlocked for: ' .. target:getName())
    target:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, '[Server] All mounts unlocked.')
    return false
end


I wanted to know the following, I want to give the Batcat mount to the test player, how do I?
 
You can use "/mounts playername" to give all mounts to the player.
If you didn't get batcat mount, you need to add it to mounts.xml


 
Type your TFS version everytime you make support thread, so people wouldn't have to guess or ask.

Here's for 1.x
LUA:
<talkaction words="/addmount" separator=" " script="add_mount.lua" />

LUA:
function onSay(player, words, param)

        if not player:getGroup():getAccess() then
        return true
        end

        if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
        end

        local split = param:split(",")
        if split[2] == nil then
        player:sendCancelMessage("Try: '/addmount playername, mountId'.")
        return false
        end

        local target = Player(split[1])
        if target == nil then
        player:sendCancelMessage("Targeted player is not online.")
        return false
        end
     
        local mountId = split[2]
        if target:hasMount(mountId) then
        player:sendCancelMessage("Targeted player already has a mount you chose.")
        else
        player:sendTextMessage(MESSAGE_EVENT_ORANGE, string.format("Mount of id: [%d] has been added to player: %s.", mountId, target:getName()))
        target:addMount(mountId)
        end
     
    return false
end

Cheers
 
Back
Top