• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

login.lua does'nt work 0.3.6

Imfreezing

Krossa Kapitalismen
Joined
Jun 7, 2012
Messages
1,009
Solutions
1
Reaction score
88
Location
Edron
Hello otland i have this login lua,but it dosnt work,please
help
all help is appriacted ::)
Code:
local condition = createConditionObject(CONDITION_INFIGHT)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)

local commonItems = {
    {itemid=2647},  -- plate legs
    {itemid=1988}, -- backpack
    {itemid=2160, count=10, inContainer = true}, -- 10 crystal coins
    {itemid=2643}, -- leather boots
    {itemid=2270,count=1,inContainer=true}, -- manarune
    {itemid=2554, inContainer = true}, -- Shovel
    {itemid=2120, inContainer = true}, -- Rope
}
local firstItems = {
    { -- Sorcerer   
        {itemid=2175}, -- spellbook
        {itemid=2190}, -- wand of vortex
        {itemid=8819}, -- magician's robe
        {itemid=8820}, -- mage hat
    },
    { -- Druid
        {itemid=2175}, -- spellbook
        {itemid=2182}, -- snakebite rod
        {itemid=8819}, -- magician's robe
        {itemid=8820}, -- mage hat
    },
    { -- Paladin
        {itemid=2525}, -- dark shield
        {itemid=2389}, -- spear
        {itemid=2463}, -- plate armor
        {itemid=2457}, -- steel helmet
    },
    { -- Knight
        {itemid=2525}, -- dark shield
        {itemid=2383}, -- spikesword
        {itemid=2463}, -- plate armor
        {itemid=2457}, -- steel helmet
    }
}
       
for _, items in ipairs(firstItems) do
    for _, item in ipairs(commonItems) do
        table.insert(items, item)
    end
end

local loginMessage = getConfigValue('loginMessage')

function onLogin(cid)
    doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, 100)

    if getPlayerAccess(cid) < 3 then
        doAddCondition(cid, condition)
    end

    local lastLogin, str = getPlayerLastLoginSaved(cid)
    if(lastLogin ~= 0) then
        str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
    else
        local bp
        for _, v in ipairs(firstItems[getPlayerVocation(cid)]) do
            if isItemContainer(v.itemid) then
                bp = doPlayerAddItem(cid, v.itemid, 1)
            elseif v.inContainer then
                doAddContainerItem(bp, v.itemid, v.count or 1)
            else
                doPlayerAddItem(cid, v.itemid, v.count or 1)
            end
        end
        str = loginMessage .. " Please choose your outfit."
        doPlayerSendOutfitWindow(cid)
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, 'Mail')
    registerCreatureEvent(cid, 'GuildMotd')
    registerCreatureEvent(cid, 'Bounty')

    registerCreatureEvent(cid, 'Think')

    -- EvoStorm
    registerCreatureEvent(cid, 'ZombieAttack')
    registerCreatureEvent(cid, 'advance')
    registerCreatureEvent(cid, 'AdvanceSave')
    registerCreatureEvent(cid, 'Logout')
    registerCreatureEvent(cid, 'points')
    registerCreatureEvent(cid, 'ReportBug')
    registerCreatureEvent(cid, 'KillExp')
    registerCreatureEvent(cid, 'WarInfo')
    registerCreatureEvent(cid, 'HuntingTask')
    registerCreatureEvent(cid, 'Death')

    -- Best Hit Counter
    if getCreatureStorage(cid, 18025) == -1 then
        doCreatureSetStorage(cid, 18025, ';0;0;0')
    end

    return true
end
Thanks
@Limos
 
i mean u get first items but not like registering all the events etc, also the
account manager is quiet till u say something
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" event="script" value="login.lua"/>
    <event type="kill" name="Bounty" script="bounty.lua"/>
    <event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
    <event type="receivemail" name="Mail" event="script" value="mail.lua"/>
    <event type="advance" name="points" event="script" value="points.lua"/>
    <event type="advance" name="advance" event="script" value="advance.lua"/>
    <event type="advance" name="AdvanceSave" event="script" value="advancesave.lua"/>
    <event type="think" name="Think" event="script" value="think.lua"/>
    <event type="advance" name="reward" event="script" value="reward50.lua"/>
    <!-- Zombie Event -->
    <event type="think" name="ZombieThink" event="script" value="zombie/onthink.lua"/>
    <event type="statschange" name="ZombieAttack" event="script" value="zombie/onattack.lua"/>
    <event type="death" name="ZombieDeath" event="script" value="zombie/ondeath.lua"/>
   
    <!-- EvoStorm -->
    <event type="death" name="KillExp" event="script" value="killexp.lua" />
    <event type="death" name="Death" event="script" value="death.lua" />
    <event type="kill" name="HuntingTask" event="script" value="taskkill.lua" />
    <event type="preparedeath" name="arena" event="script" value="arena.lua" />
    <!--event type="statschange" name="BestHit" event="script" value="evostorm/besthit.lua" /-->
</creaturescripts>
Specify what is not working, and maybe post your creaturescript.xml if its a register problem.
 
Back
Top