• 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 wont work

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
20
Location
Netherlands ;3
Hey guys,

I compiled myself a server and am trying out all the commands but i can only do /a with my god char. All other talkactions like /n , /m and /i dont work. I dont get a message ingame or a console message. Any ideas? I compiled this distribution https://otland.net/threads/10-90-cast-tfs-1-2-custom-modifications-reward-chest.238852/

Talkactions.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<talkactions>
    <!-- commands -->
    <talkaction words="/ban" separator=" " script="ban.lua" />
    <talkaction words="/ipban" separator=" " script="ipban.lua" />
    <talkaction words="/unban" separator=" " script="unban.lua" />
    <talkaction words="/up" script="up.lua" />
    <talkaction words="/down" script="down.lua" />
    <talkaction words="/c" separator=" " script="teleport_creature_here.lua" />
    <talkaction words="/goto" separator=" " script="teleport_to_creature.lua" />
    <talkaction words="/owner" separator=" " script="owner.lua" />
    <talkaction words="/t" script="teleport_home.lua" />
    <talkaction words="/town" separator=" " script="teleport_to_town.lua" />
    <talkaction words="/a" separator=" " script="teleport_ntiles.lua" />
    <talkaction words="/pos" separator=" " script="position.lua" />
    <talkaction words="/info" separator=" " script="info.lua" />
    <talkaction words="/r" separator=" " script="removething.lua" />
    <talkaction words="/kick" separator=" " script="kick.lua" />
    <talkaction words="/openserver" script="openserver.lua" />
    <talkaction words="/closeserver" separator=" " script="closeserver.lua" />
    <talkaction words="/B" separator=" " script="broadcast.lua" />
    <talkaction words="/m" separator=" " script="place_monster.lua" />
    <talkaction words="/i" separator=" " script="create_item.lua" />
    <talkaction words="/s" separator=" " script="place_npc.lua" />
    <talkaction words="/addtutor" separator=" " script="add_tutor.lua" />
    <talkaction words="/removetutor" separator=" " script="remove_tutor.lua" />
    <talkaction words="/looktype" separator=" " script="looktype.lua" />
    <talkaction words="/summon" separator=" " script="place_summon.lua" />
    <talkaction words="/chameleon" separator=" " script="chameleon.lua" />
    <talkaction words="/addskill" separator=" " script="add_skill.lua" />
    <talkaction words="/mccheck" script="mccheck.lua" />
    <talkaction words="/ghost" script="ghost.lua" />
    <talkaction words="/clean" script="clean.lua" />
    <talkaction words="/hide" script="hide.lua" />

    <!-- player talkactions -->
    <talkaction words="!buypremium" script="buyprem.lua" />
    <talkaction words="!buyhouse" script="buyhouse.lua" />
    <talkaction words="!leavehouse" script="leavehouse.lua" />
    <talkaction words="!changesex" script="changesex.lua" />
    <talkaction words="!uptime" script="uptime.lua" />
    <talkaction words="!deathlist" script="deathlist.lua" />
    <talkaction words="!kills" script="kills.lua" />
    <talkaction words="!online" script="online.lua" />
    <talkaction words="!serverinfo" script="serverinfo.lua" />
    <talkaction words="!cast" separator=" " script="start_cast.lua" />
    <talkaction words="!stopcast" script="stop_cast.lua" />

    <!-- test talkactions -->
    <talkaction words="!z" separator=" " script="magiceffect.lua" />
    <talkaction words="!x" separator=" " script="animationeffect.lua" />
</talkactions>

create_item.lua as example of one not working
Code:
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(",")

    local itemType = ItemType(split[1])
    if itemType:getId() == 0 then
        itemType = ItemType(tonumber(split[1]))
        if itemType:getId() == 0 then
            player:sendCancelMessage("There is no item with that id or name.")
            return false
        end
    end

    local count = tonumber(split[2])
    if count ~= nil then
        if itemType:isStackable() then
            count = math.min(10000, math.max(1, count))
        elseif not itemType:isFluidContainer() then
            count = math.min(100, math.max(1, count))
        else
            count = math.max(0, count)
        end
    else
        if not itemType:isFluidContainer() then
            count = 1
        else
            count = 0
        end
    end

    local result = player:addItem(itemType:getId(), count)
    if result ~= nil then
        if not itemType:isStackable() then
            if type(result) == "table" then
                for _, item in ipairs(result) do
                    item:decay()
                end
            else
                result:decay()
            end
        end
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    end
    return false
end

teleport_ntiles.lua a working command
Code:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    local steps = tonumber(param)
    if not steps then
        return false
    end

    local position = player:getPosition()
    position:getNextPosition(player:getDirection(), steps)

    position = player:getClosestFreePosition(position, false)
    if position.x == 0 then
        player:sendCancelMessage("You cannot teleport there.")
        return false
    end

    player:teleportTo(position)
    return false
end

Would appreciate some help.

-SoloQ
 

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,958
Solutions
52
Reaction score
650
GroupID = 3 ----IN PLAYERS TABLE ON DATABASE
Account Type = 6 --IN ACCOUNTS TABLE ON DATABASE


Code:
<group id="6" name="God" flags="39579197349882" customFlags="67108863" access="5" depotLimit="5000" maxVips="500" outfit="302"/>

That means your account type not your players groupID
 
Last edited:
OP
OP
SoloQ

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
20
Location
Netherlands ;3
GroupID = 3 ----IN PLAYERS TABLE ON DATABASE
Account Type = 6 --IN ACCOUNTS TABLE ON DATABASE


Code:
<group id="6" name="God" flags="39579197349882" customFlags="67108863" access="5" depotLimit="5000" maxVips="500" outfit="302"/>

That means your account type not your players groupID
Did you even read that that was not my group.xml?

no, that is char types, not account types
when you printed ACCOUNT_TYPE_GOD earlier, it was defined as 5
go into database
open database
click ACCOUNTS
change the TYPE on the account to 5
do not go into PLAYERS

edit:
if you have a /lua executing command you can also do it like
Code:
player:setAccountType(ACCOUNT_TYPE_GOD)
or if you have Znote AAC you can set it on admin page

Setting my account typ to 5 did the job, cheers man.

But seeing my group.xml only has player, gamemaster and god. How can I add like tutor and set him certain commands? also:
Code:
    if player:getAccountType() < ACCOUNT_TYPE_TUTOR then
        return false
    end
 
OP
OP
SoloQ

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
20
Location
Netherlands ;3
I tried adding my old groups.xml from 8.6 that had the tutors and everything in but i cant use that one since I think the Flags are wrong? How can I get them to 10.9?
 

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,958
Solutions
52
Reaction score
650
You cannot edit:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<groups>
<group id="1" name="player" flags="0" access="0" maxdepotitems="0" maxvipentries="0" />
<group id="2" name="gamemaster" flags="137438953471" access="1" maxdepotitems="0" maxvipentries="200" />
<group id="3" name="god" flags="272730398714" access="1" maxdepotitems="0" maxvipentries="200" />
</groups>

Without making source edits (if I am correct) I tried doing it and was unsuccessful but I realized it really wasn't needed because you still have tutors in tfs 1.x

You just use !addtutor then in scripts you use ACCOUNT_TYPE_TUTOR....

Again I didn't mess with it for too long because it was useless but I am pretty sure it requires source edits now.
 

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,958
Solutions
52
Reaction score
650
player:getAccess():getGroupId()

1, 2, 3, 4, 5, 6
tutor, sinior tutor, gamemaster, community manager, senior CM, god
 
OP
OP
SoloQ

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
20
Location
Netherlands ;3
player:getAccess():getGroupId()

1, 2, 3, 4, 5, 6
tutor, sinior tutor, gamemaster, community manager, senior CM, god
Seeing as I only have groups 1 to 3 and having 3 set to make me god this wont work will it?
Access for gamemaster and god is also the same. Only the script checks for the account_type
 

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,958
Solutions
52
Reaction score
650
Well, then you could just make a database check. I am pretty sure the above method works but maybe I am wrong. If not you can do:

check database player->groupid

Which is where you put 1-6

Follow the above message for what 1-6 means...

Then use the database check for your if statement.

something like:

Code:
function getPlayerGroupId(player)
  local value = db.getResult("SELECT `groupid` FROM `players` WHERE `id` = " .. player:getId() .. " LIMIT 1;") 
   if(value:getID() ~= -1) then 
    return value:getDataInt("groupid") 
   else 
    return -1 
   end
   value:free() 
 end

if getPlayerGroupId(player) == 1 then
print("He is a tutor.")
elseif getPlayerGroupId(player) == 2 then
print("He is a sinior tutor.")
else
print("He is not a tutor.")
end
 

johnsamir

Active Member
Joined
Oct 13, 2009
Messages
232
Solutions
1
Reaction score
35
Location
Nowhere
how do i do talkactions for tutor? have used command /addtutor, it worked then i made an script that only should work for tutor and did this, tfs 1.3
Lua:
function onSay(player, words, param)
    if player:getAccountType() == ACCOUNT_TYPE_TUTOR then
        return false
    end

    local target = Creature(param)
    if target then
        player:teleportTo(target:getPosition())
    else
        player:sendCancelMessage("Creature not found.")
    end
    return false
end
Code:
<!-- tutor talkactions -->
    <talkaction words="!tutorgoto" script="tutor_teleport_to.lua" />

it doesn't work, ain't getting errors in console
 
Top