• 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!

Lua Talkactions, /n < for spawning npc's

Aradz

New Member
Joined
Sep 19, 2013
Messages
51
Reaction score
1
Hello, it seems like my command /n dosnt it just don't allow me to spawn npc's. anyone know why ?
 
replace your with this,
works for me
Code:
function onSay(cid, words, param, channel)
    local func = doCreateMonster
    if(words:sub(2, 2) == "n") then
        func = doCreateNpc
    end

    local pid = cid
    local t = string.explode(param, ",")
    if(t[2]) then
        pid = getPlayerByNameWildcard(t[2])
        if(not pid) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
            return true
        end
    end

    local position = getCreaturePosition(pid)
    local effect = CONST_ME_MAGIC_RED
    local ret = func(t[1], position, false)
    if(tonumber(ret) == nil) then
        effect = CONST_ME_POFF
        doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
    end

    doSendMagicEffect(position, effect)
    return true
end
 
Back
Top