Ir para conteúdo

Featured Replies

Postado
Em 05/09/2016 em 11:48, Vodkart disse:

tinha uma linha com um ' a mais, corrigido.

 

Desculpe se estou revivendo o tópico, mais aqui não esta funcionando. Não aparece nenhum erro na distro.

Uso OTX 2.3 (0.4)

 

 


local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}


function onLogin(cid)
 

    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil and getPlayerStorageValue(cid, "bless") ~= 5) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    if(getPlayerStorageValue(cid, "death_bless") == 1) then
        local t = {PLAYERLOSS_EXPERIENCE, PLAYERLOSS_SKILLS, PLAYERLOSS_ITEMS, PLAYERLOSS_CONTAINERS}
        for i = 1, #t do
            doPlayerSetLossPercent(cid, t, 100)
        end
        setPlayerStorageValue(cid, "death_bless", 0)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end
        
function onLogin(cid)
    local days = 3
    if db.getResult("SELECT `premiumgift` FROM `accounts` WHERE `id = "..getPlayerAccountId(cid)):getDataInt("premiumgift") <= 0 then
        doPlayerAddPremiumDays(cid, days)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua account acabou de receber "..days.." dias de premium, boa diversão!")
        db.executeQuery("UPDATE `accounts` SET `premiumgift` = 1 WHERE `id` = "..getPlayerAccountId(cid))
    end
    return true
end        

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        addEvent(valid(doCreatureSay), 500, cid, "Hello, it appears that your character has been locked for name violating rules, what new name would you like to have?", TALKTYPE_PRIVATE_NP, true, cid)
    elseif(accountManager == MANAGER_ACCOUNT) then
        addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to manage your account. If you would like to start over, type {cancel} anywhere.", TALKTYPE_PRIVATE_NP, true, cid)
    else
        addEvent(valid(doCreatureSay), 500, cid, "Hello, type {account} to create an account or {recover} to recover an account.", TALKTYPE_PRIVATE_NP, true, cid)
    end

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

    registerCreatureEvent(cid, "Idle")
    registerCreatureEvent(cid, "Mail")
    if(getPlayerOperatingSystem(cid) >= CLIENTOS_OTCLIENT_LINUX) then
        registerCreatureEvent(cid, "ExtendedOpcode")
    end

    registerCreatureEvent(cid, "ReportBug")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
    end
    doPlayerOpenChannel(cid, 11)
    registerCreatureEvent(cid, "GuildEvents")
    registerCreatureEvent(cid, "AdvanceSave")
    registerCreatureEvent(cid, "recordIp")
    registerCreatureEvent(cid, "partyAndGuildProtection")
    registerCreatureEvent(cid, "lookvip")
    registerCreatureEvent(cid, "promo")
    registerCreatureEvent(cid, "TopEffect")
    registerCreatureEvent(cid, "CheckTop")
    registerCreatureEvent(cid, "noattack")
    registerCreatureEvent(cid, "onlinebonus")
    registerCreatureEvent(cid, "test")
    registerCreatureEvent(cid, "exp")
    registerCreatureEvent(cid, "anunciarmorte")
    registerCreatureEvent(cid, "firstitems")
    registerCreatureEvent(cid, "party")
    registerCreatureEvent(cid, "infos")
    registerCreatureEvent(cid, "IOE")
 
        
        
    return true
end
 

 

 

Editado por tetheuscunha (veja o histórico de edições)

Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.

  • Respostas 11
  • Visualizações 2.7k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Posted Images

Postado
12 horas atrás, Vodkart disse:

@tetheuscunha Não vai funcionar mesmo, colocou 2 função main juntas...

 

Quando eu tiro a função da um erro na distro. E se eu crio um arquivo tbm da erro.

 

distro.thumb.png.cc305e2ede5d9df05f4b770c12c4e04c.png

 

 

 

EDIT:

 

Arrumei estava faltando um ` na linha

if db.getResult("SELECT `premiumgift` FROM `accounts` WHERE `id` = "..getPlayerAccountId(cid)):getDataInt("premiumgift") <= 0 then

Editado por tetheuscunha (veja o histórico de edições)

Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.

  • 9 months later...
Postado

Olá, sou novo nesse lance de scripts e de otserv. Eu gostaria de saber em qual pasta eu tenho que colocar esse script, pois no meu servidor não tem essa pasta onLogin. E onde eu executo esse comando:

ALTER TABLE `accounts` ADD `premiumgift` INT NOT NULL DEFAULT '0'

Agradeço desde já e desculpe a minha ignorância.

Editado por Bigatinho (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 520.1k

Informação Importante

Confirmação de Termo