• 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 [TFS 1.X] How to properly add an event on login.lua?

Elwthz

Member
Joined
Jun 5, 2015
Messages
72
Reaction score
5
Hello,

I'm using the lattest commit of TFS at Github...

I been trying some creatureevents but they doesn't works, i guess that's because of the login.lua (event)

player:registerEvent("")

I try to use like that and the event between "", is that right or what's the right way to do it?

Regards
 
Here, @Codex NG

Code:
function onLogin(player)
 
    --if getPlayerAccess(cid) > 3 then
      --doPlayerSendCancel(cid, "$@$Administrador")
      --doPlayerSendCancel(cid, " ")
    --end

    local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. " Please choose your outfit."
        player:sendOutfitWindow()
    else
        if loginStr ~= "" then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format("Your last visit was on %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    -- Stamina
    nextUseStaminaTime[player.uid] = 0

    -- Promotion
    local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(STORAGEVALUE_PROMOTION)
        if not promotion and value ~= 1 then
            player:setStorageValue(STORAGEVALUE_PROMOTION, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end

    -- Events
    player:registerEvent("PlayerDeath")
    player:registerEvent("DropLoot")
    player:registerEvent("customEvent")
    return true
end
 
Sorry, I'm kinda new, i have to make an edition on sources or just creaturescripts?.. I didn't get it xD

<event type="preparedeath" name="custom One" script="modaldeath.lua"/>
<event type="modalwindow" name="customTwo" script="modaldeath.lua"/>
<event type="login" name="customThree" script="modaldeath.lua"/>

Im using this one and trying to add them like this at login:

-- Events
player:registerEvent("PlayerDeath")
player:registerEvent("DropLoot")
player:registerEvent("customOne")
player:registerEvent("customTwo")
player:registerEvent("customThree")
return true
 
Sorry, I'm kinda new, i have to make an edition on sources or just creaturescripts?.. I didn't get it xD
I was providing you with a link to the sources so you could see for yourself the types and interfaces which use those types.
 
Back
Top