• 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 [TFS 1.2] Check if player isMounted

Caduceus

Unknown Member
Joined
May 10, 2010
Messages
321
Solutions
2
Reaction score
24
Can someone tell me how I would check to see if a player was mounted, onSay. If the player is mounted and you change the looktype, all players in the area of the player will debug. So, I need a return false on isMounted().

my fix
Code:
if player:getOutfit().lookMount > 0 then
        player:sendCancelMessage("this player is currently mounted.")
        return false
    end


Code:
function onSay(player, words, param)
     if not player:getGroup():getAccess() then
         return true
     end
   
     if player:getOutfit().lookMount > 0 then
        player:sendCancelMessage("this player is currently mounted.")
        return false
    end
   
     local t = param:split(",")
     local lookType = tonumber(t[1])
     if not lookType then
         lookType = MonsterType(t[1]) and MonsterType(t[1]):getOutfit().lookType
         if not lookType then
             player:sendCancelMessage("A monster with that name does not exist.")
             return false
         end
     end
     if t[2] then
         playerx, player = player, Player(t[2]:gsub("^%s*(.-)%s*$", "%1"))
         if not player then
             playerx:sendCancelMessage("A player with that name does not exist or is not online.")
             return false
         end
     end
     if lookType >= 0 and lookType ~= 1 and lookType ~= 135 and lookType ~= 411 and lookType ~= 415 and lookType ~= 424 and (lookType <= 160 or lookType >= 192) and lookType ~= 439 and lookType ~= 440 and lookType ~= 468 and lookType ~= 469 and (lookType < 474 or lookType > 485) and lookType ~= 501 and lookType ~= 518 and lookType ~= 519 and lookType ~= 520 and lookType ~= 524 and lookType ~= 525 and lookType ~= 536 and lookType ~= 543 and lookType ~= 549 and lookType ~= 576 and lookType ~= 581 and lookType ~= 582 and lookType <= 595 then
         local playerOutfit = player:getOutfit()
         playerOutfit.lookType = lookType
         player:setOutfit(playerOutfit)
     else
         player = playerx or player
         player:sendCancelMessage("A look type with that id does not exist.")
     end
     return false
    end
 
Last edited:
your sources don't have "isMounted()" ?

Have this, but I didn't know how to apply it to script. It works as I have it. May not be the "best" way, but it works.

Code:
bool isMounted() const {
            return defaultOutfit.lookMount != 0;
        }
 
Code:
if player:isMounted() then
     return false
end


with doing this I get errors.. The other way works, I will just stick to that.

Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/looktype.lua:onSay
data/talkactions/scripts/looktype.lua:11: attempt to call method 'isMounted' (a nil value)
stack traceback:
        [C]: in function 'isMounted'
        data/talkactions/scripts/looktype.lua:11: in function <data/talkactions/scripts/looktype.lua:1>
 
Back
Top