• 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
 

Zothion

Veteran OT User
Joined
Apr 28, 2014
Messages
1,092
Reaction score
392
yes, but then it doesnt check if ur a god...
you sure your account is a god? i use it like this and it works fine
my god has getAccess() == true and AccountType() == 6, and ACCOUNT_TYPE_GOD is 5, so it works fine on my end
 
OP
OP
SoloQ

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
20
Location
Netherlands ;3
Yes I have found that if I remove it it works. Done some digging and found:
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>
I figure that this is the cause of the problem. But if i change the god access 5 it just ungods me and I cannot use any commands.
I tried doing the following from another OT:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<groups>
    <group id="1" name="Player"/>
    <group id="2" name="Tutor" flags="16809984" customFlags="2" access="1"/>
    <group id="3" name="Senior Tutor" flags="68736352256" customFlags="14" access="2" maxVips="200"/>
    <group id="4" name="Gamemaster" flags="3808558964575" customFlags="257215" access="3" depotLimit="3000" maxVips="300" outfit="75"/>
    <group id="5" name="Community Manager" flags="3840774348794" customFlags="781823" access="4" depotLimit="4000" maxVips="400" outfit="266"/>
    <group id="6" name="God" flags="39579197349882" customFlags="67108863" access="5" depotLimit="5000" maxVips="500" outfit="302"/>
</groups>

This however did not fix my problem.
How can I set my own groups.xml to this new 1 to 6 group ID and actually make it work?
 

Zothion

Veteran OT User
Joined
Apr 28, 2014
Messages
1,092
Reaction score
392
try adding
Code:
print(player:getAccountType(), ACCOUNT_TYPE_GOD, player:getGroup():getAccess())
at the start of the script and tell me what it says
 

Zothion

Veteran OT User
Joined
Apr 28, 2014
Messages
1,092
Reaction score
392
well theres the problem, your account type is 1, and the GOD type in script is 5
youd have to change your acc type in the database i guess, i dont have the dist ur using and im not gonna bother with compiling it to test
try
Code:
print(player:getAccess())

edit: if only gods have group 3 you could change
Code:
if player:getAccountType() < ACCOUNT_TYPE_GOD then
return false
end
to
Code:
if player:getGroup():getId() < 3 then
return false
end
 
Last edited:
OP
OP
SoloQ

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
20
Location
Netherlands ;3
This gives me the following:
https://gyazo.com/a207d2734a697d24b251e9d99522b616

Note that I am using the /a to test it.
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)
    print(player:getAccess())
    return false
end
 

Zothion

Veteran OT User
Joined
Apr 28, 2014
Messages
1,092
Reaction score
392
yea i forgot to add :getId() after it, i edited it in
player:getGroup():getId() returns 3 for a god, player:getGroup():getName() returns "god"
 
OP
OP
SoloQ

SoloQ

Hard With Style
Joined
Mar 12, 2009
Messages
557
Reaction score
20
Location
Netherlands ;3
Yes, this has worked but does this mean that I have to edit every script for who may use it by group id?
Can i not remove the lines where it looks for the group id in the script and make the restriction in the talkactions.xml by setting an access?
 

Zothion

Veteran OT User
Joined
Apr 28, 2014
Messages
1,092
Reaction score
392
as far as i know 1.2 has all acess checks inside the scripts... you'd have to find out why accountType isnt the same value as ACCOUNT_TYPE_GOD for some reason, or change them all
 
OP
OP
SoloQ

SoloQ

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

Zothion

Veteran OT User
Joined
Apr 28, 2014
Messages
1,092
Reaction score
392
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
 
Last edited:

Itutorial

Premium User
Premium User
Joined
Dec 23, 2014
Messages
1,958
Solutions
52
Reaction score
650
Ill explain like Zothion did also....

GO INTO
DATABASE/ACCOUNTS/EDIT YOUR ACCOUNT/CHANGE TYPE TO 6 NOT 5

THAT IS ///////ACCOUNT//////// NOT //////PLAYERS////////

CHANGE ///YOUR////////ACCOUNTS/////////TYPE/////////TO//////////6///////////NOT//////////5

NOT////////YOUR/////////PLAYERS/////////GOUPID//////TO//////////6////////////////////
 
Top