• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction God summon script

shoxsz

New Member
Joined
Sep 23, 2012
Messages
1
Reaction score
0
I downloaded a server for tibia 9.6 version and created a GOD but this server do not have the commands for the god, so i'm trying to create them, but i'm new in otserver programing, i'm trying to create the command(talkaction): /m to summon creatures, that's ok, some research on google to explain some things have worked well, but now i got a problem that can't be solved on the web: how can i get parameters for the command? when i use only '/m' the script run with 'param'(from onSay) null, when i use '/m Demon' the command do not run, here's what i've done:

Code:
function onSay(cid, words, param)

    usage = "/m creature_name [, count]."
 
    -- I couldn't see the type of 'param': can be an array or just a string, while i don't know, i'm assuming that it is an array(non zero based)
 
    -- No parameters?
    if param == nil then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, usage)
    else
        -- Check if is god
        if getPlayerGroupId(cid) == 3 then
            -- Check if is a valid creature
            id = getCreatureByName(param[1])
            if id ~= nil and isCreature(id) then
                -- Loop to summon the creatures
                for i = 0, param[2] do
                    position = getPlayerPosition(cid)
                    --Only increment 1 on x, the game will find the right place to put the creature
                    position.x = position.x+1
                    doSummonCreature(param[1], position)
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The creature ".. param[1] .." does not exist.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not allowed to use this command.")
        end
    end
 
    --This code here is for test the value of 'param'
    --doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param)
 
end

the talkactions.xml

HTML:
<talkaction words="/m" script="god_summon.lua"/>

if someone can help me i'll thank you.
 
Back
Top