Ir para conteúdo
  • Cadastre-se

(Resolvido)[SQLite] -=[TFS]=- 0.4 8.60 [CREATURESCRIPT] VIP Days Não Funciona Alguem Pode me Ajuda


Ir para solução Resolvido por Mateus Robeerto,

Posts Recomendados

@Vodkart

 

TALKACTION SYSTEMVIP:

function onSay(cid, words, param)
    if words == "!buyvip" then
		-- Check player with VIP
		if getPlayerStorageValue(cid, 13545) - os.time() > 0 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você já tem vip, espere seu tempo acabar, para verificar com !vipdays.")
			return true
		end
		
		local itemid = 2159
		local count = 100000
		
        if doPlayerRemoveItem(cid, itemid, count) then
            local days = 31
            local daysvalue = days * 24 * 60 * 60
            local storageplayer = getPlayerStorageValue(cid, 13545)
            local timenow = os.time()
            
            local time
            if getPlayerStorageValue(cid, 13545) - os.time() <= 0 then
                time = timenow + daysvalue
            else
                time = storageplayer + daysvalue
            end
            
            if string.find(tostring(getCreatureName(cid)), "[[VIP]]") then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados " .. days .. " dias de VIP no seu character.")
                setPlayerStorageValue(cid, 13545, time)
                local quantity = math.floor((getPlayerStorageValue(cid, 13545) - timenow) / (24 * 60 * 60))
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem " .. (quantity < 0 and 0 or quantity) .. " dias de VIP restantes.")
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados " .. days .. " dias de VIP no seu character.")
                setPlayerStorageValue(cid, 13545, time)
                local name = getCreatureName(cid)
                db.executeQuery("UPDATE `players` SET `name` = '[VIP] " .. name .. "' WHERE `id` = " .. getPlayerGUID(cid) .. ";")
                doRemoveCreature(cid)
            end
        else
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa de [" .. count .. " " .. getItemNameById(itemid) .. "] para colocar VIP.")
        end
    elseif words == "!vipdays" then
        local timenow = os.time()
        local quantity = math.floor((getPlayerStorageValue(cid, 13545) - timenow) / (24 * 60 * 60))
		if quantity > 0 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce tem " .. quantity .. " dias de VIP no seu character.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nao tem dias vip.")
		end
 elseif words == "/checkvip" then
        if getPlayerAccess(cid) == 5 then
            if not param then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
            else
                local player = getPlayerByName(param)
                if not isPlayer(player) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
                else
                    local timenow = os.time()
                    local quantity = math.floor((getPlayerStorageValue(player, 13545) - timenow) / (24 * 60 * 60))
                    if quantity > 0 then
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce tem " .. quantity .. " dias de VIP no seu character.")
					else
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nao tem dias vip.")
					end
                end
            end
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não tem acesso a este comando.")
        end
    elseif words == "/addvip" then
        if getPlayerAccess(cid) == 5 then
            local t = string.explode(param, ",")
            if not t[2] then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
            else
                local playerName = t[1]
                local player = getPlayerByName(playerName)
                local name = getCreatureName(player)
                local days = tonumber(t[2])
                local pid = getPlayerByNameWildcard(playerName)
                
                if not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid)) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn't exist or is offline.")
                    return TRUE
                end
                
                local daysvalue = days * 3600 * 24
                local storageplayer = getPlayerStorageValue(player, 13545)
                local timenow = os.time()
                local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)
                
                if string.find(tostring(getCreatureName(pid)), "[[VIP]]") then
                    doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados " .. days .. " dias de VIP no seu character.")
                    setPlayerStorageValue(player, 13545, time)
                    local quantity = math.floor((getPlayerStorageValue(player, 13545) - timenow) / (3600 * 24))
                    doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você tem " .. quantity .. " dias de VIP restantes.")
                else
                    setPlayerStorageValue(player, 13545, time)
                    db.executeQuery("UPDATE `players` SET `name` = '[VIP] " .. name .. "' WHERE `id` = " .. getPlayerGUID(player) .. ";")
                    doRemoveCreature(player)
                end
            end
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não tem acesso a este comando.")
        end
    elseif words == "/delvip" then
		if getPlayerAccess(cid) == 5 then
            local dec = MESSAGE_INFO_DESCR
            if param == "" then
                return TRUE, doPlayerSendTextMessage(cid, 18, "Command param required.")
            end
            local C, t = {}, string.explode(param, ",")
            C.pos = getPlayerPosition(cid)
            C.uid = getCreatureByName(t[1])
            C.time = ((tonumber(t[2]) == nil) and 1 or tonumber(t[2])) * 3600 * 24 -- Tempo da VIP por dia.
            C.days = (tonumber(t[2]) == nil) and 1 or tonumber(t[2]) -- Dias de VIP.
            
            if getPlayerStorageValue(C.uid, 13545) < C.time then
                doPlayerSendTextMessage(cid, dec, 'O jogador ' .. t[1] .. ' não possui ' .. C.days .. ' dias de VIP.')
            else
                doPlayerSendTextMessage(cid, dec, 'Você removeu ' .. C.days .. ' dias de VIP do player ' .. t[1] .. '.')
                setPlayerStorageValue(C.uid, 13545, getPlayerStorageValue(C.uid, 13545) - C.time)
            end
            doSendMagicEffect(C.pos, math.random(28, 30))
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não tem acesso a este comando.")
		end
    end
    return true
end

 

MOVEMENTS TILE: 

-- Script Vip Sytem 1.0 --
function onStepIn(cid, item, position, fromPosition)

local config = {
msgDenied = "Voce Nao e [VIP] Digite !buyvip 100k [Donate] Coin.",
msgWelcome = "Seja Bem Vindo a Área -=[VIP]=-"
}

if getPlayerStorageValue(cid, 13545) - os.time() <= 0 then
doTeleportThing(cid, fromPosition, true)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return TRUE
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgWelcome)
return TRUE
end

 

@GM Vortex 

 

[09/01/2024 19:50:13] [Error - CreatureScript Interface] 
[09/01/2024 19:50:13] data/creaturescripts/scripts/meupix.lua:onLogin
[09/01/2024 19:50:13] Description: 
[09/01/2024 19:50:13] data/creaturescripts/scripts/meupix.lua:23: attempt to call global 'addVipDays' (a nil value)
[09/01/2024 19:50:13] stack traceback:
[09/01/2024 19:50:13] 	data/creaturescripts/scripts/meupix.lua:23: in function <data/creaturescripts/scripts/meupix.lua:1>
[09/01/2024 19:50:13] Account Manager has logged out.

[09/01/2024 19:50:13] [Error - CreatureScript Interface] 
[09/01/2024 19:50:13] In a timer event called from: 
[09/01/2024 19:50:13] data/creaturescripts/scripts/login.lua:onLogin
[09/01/2024 19:50:13] Description: 
[09/01/2024 19:50:13] (luaGetCreatureName) Creature not found

 

Link para o post
Compartilhar em outros sites
  • Respostas 7
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

function onLogin(cid) local storageKeys = { 13545, } local alreadyReceived = true for _, storageKey in ipairs(storageKeys) do if getCreatureStorage(cid, storageKey) ~= 1 then alreadyReceived = false break end end if not alreadyReceived then for _, storageKey in ipairs(storageKeys) do if getCreatureStorage(cid, storageKey) ~= 1 then doCreatureSetStorage(cid, storageKey, 1) en

function onLogin(cid)
    local storageVipReceived = 13546
    local vipDays = 2

    if getPlayerStorageValue(cid, storageVipReceived) ~= 1 then
        local currentVipTime = getPlayerStorageValue(cid, PLAYER_STORAGE.VIP_TIME)
        local currentTime = os.time()

        if currentVipTime == 0 or currentVipTime < currentTime then
            setPlayerStorageValue(cid, PLAYER_STORAGE.VIP_TIME, currentTime + (vipDays * 86400))
            setPlayerStorageValue(cid, storageVipReceived, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você recebeu " .. vipDays .. " dias de VIP.")
        end
    end

    return TRUE
end

 

Editado por GM Vortex (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
local configZero = {
	storageOneInLife = 13545, -- to win only once in a lifetime
	message = "PARABENS!!\nVoce ganhou 2 dias VIP!", -- message
	vipStorage = 13545, -- vip storage
	vipDays = 2, -- vip days
}

function onLogin(cid)
	if getPlayerStorageValue(cid, configZero.storageOneInLife) < 1 then
		local currentVipTime = getPlayerStorageValue(cid, configZero.vipStorage)
		local newVipTime = os.time() + (configZero.vipDays * 24 * 60 * 60)
		setPlayerStorageValue(cid, configZero.vipStorage, currentVipTime + newVipTime)

		local days = configZero.vipDays
		doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, configZero.message)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você recebeu um " .. days .. " dias de VIP, bom jogo!")

		-- Broadcast to all players
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O jogador " .. getPlayerName(cid) .. " recebeu " .. days .. " dias de VIP, bom jogo!")
	end
	return true
end

 

@GM Vortex esse aqui pego mais fica aparecendo memsagens status vip no account manager

local configZero = {
	storageOneInLife = 135545, -- pra ganhar só 1 vez na vida
	message = "PARABENS!!\nVoce ganhou 2 dias VIP!", -- message
	messageType = MESSAGE_INFO_DESCR,
	vipStorage = 13545, -- storage vip
	vipDays = 2, -- dias vip
	accountManagerVerify = true, -- muda para false se não funcionar
}

function onLogin(cid)
	if configZero.accountManagerVerify then
		if getCreatureName(cid) == "Account Manager" then
			return true -- para não afetar o account manager
		end
	end
	
	if getPlayerStorageValue(cid, configZero.storageOneInLife) < 1 then
		local currentVipTime = getPlayerStorageValue(cid, configZero.vipStorage)
		local newVipTime = os.time() + (configZero.vipDays * 24 * 60 * 60)
		setPlayerStorageValue(cid, configZero.vipStorage, currentVipTime + newVipTime)
		setPlayerStorageValue(cid, configZero.storageOneInLife, 1)
		doPlayerSendTextMessage(cid, configZero.messageType, configZero.message)
	end
	return true
end

 

 

EU QUERIA QUE FUNCIONASSE SÓ POR 1 CONTA QUE CRIA E PRA 1 PERSONAGEM E NAO CRIA OUTROS PERSONAGENS E GANHA VIP SOMENTE PRA 1 CONTA E PRA 1 PERSONAGEM QUE CRIA NA CONTA SE CRIA OUTRO PERSONAGEM NAO GANHA VIP.

 

 

2 horas atrás, GM Vortex disse:

function onLogin(cid)
    local storageVipReceived = 13546
    local vipDays = 2

    if getPlayerStorageValue(cid, storageVipReceived) ~= 1 then
        local currentVipTime = getPlayerStorageValue(cid, PLAYER_STORAGE.VIP_TIME)
        local currentTime = os.time()

        if currentVipTime == 0 or currentVipTime < currentTime then
            setPlayerStorageValue(cid, PLAYER_STORAGE.VIP_TIME, currentTime + (vipDays * 86400))
            setPlayerStorageValue(cid, storageVipReceived, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você recebeu " .. vipDays .. " dias de VIP.")
        end
    end

    return TRUE
end

 

NÃO PEGO!

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Estatísticas dos Fóruns

    96842
    Tópicos
    519597
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo