Ir para conteúdo

Featured Replies

Postado

Talvez?

local config = {
	storageValue = 5849, -- storage para checar se tem o nome ou não
	days = 30,
	daysvalue = days * 24 * 60 * 60,
	storageplayer = getPlayerStorageValue(cid, 23510),
	timenow = os.time(),
	time = getPlayerStorageValue(cid, 23510) - os.time() <= 0 and timenow + daysvalue or storageplayer + daysvalue
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. config.days .." dias de VIP no seu character.")
	setPlayerStorageValue(cid, 23510, config.time)
	if getPlayerStorageValue(cid, config.storageValue) < 1 then
		setPlayerStorageValue(cid, config.storageValue, 1)
		db.executeQuery("UPDATE `players` SET `name` = '[VIP]" .. getCreatureName(cid) .. "' WHERE `id` = " .. getPlayerGUID(cid))
	end
	local quantity = math.floor((getPlayerStorageValue(cid, 23510) - config.timenow)/(24 * 60 * 60))
	doSendMagicEffect(getPlayerPosition(cid), math.random(28,30))
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. config.quantity .." dias de VIP restantes.")
	doRemoveItem(item.uid, 1) 
	return true
end 

 

  • Respostas 11
  • Visualizações 477
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Actions <action itemid="xxxx" script="vipdonat.lua"/> vipdonat.lua: (13778) storage, mude-a para desejada function onUse(cid, item, fromPosition, itemEx, toPosition) local config={ r

Postado
  • Autor
Em 26/12/2015 14:32:16, vankk disse:

Talvez?


local config = {
	storageValue = 5849, -- storage para checar se tem o nome ou não
	days = 30,
	daysvalue = days * 24 * 60 * 60,
	storageplayer = getPlayerStorageValue(cid, 23510),
	timenow = os.time(),
	time = getPlayerStorageValue(cid, 23510) - os.time() <= 0 and timenow + daysvalue or storageplayer + daysvalue
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. config.days .." dias de VIP no seu character.")
	setPlayerStorageValue(cid, 23510, config.time)
	if getPlayerStorageValue(cid, config.storageValue) < 1 then
		setPlayerStorageValue(cid, config.storageValue, 1)
		db.executeQuery("UPDATE `players` SET `name` = '[VIP]" .. getCreatureName(cid) .. "' WHERE `id` = " .. getPlayerGUID(cid))
	end
	local quantity = math.floor((getPlayerStorageValue(cid, 23510) - config.timenow)/(24 * 60 * 60))
	doSendMagicEffect(getPlayerPosition(cid), math.random(28,30))
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. config.quantity .." dias de VIP restantes.")
	doRemoveItem(item.uid, 1) 
	return true
end 

 

 

Deu esse erro ake 

 

data/actions/scripts/vip/epicvip3.lua:4: attempt to perform arithmetic on global 'days' (a nil value)
[28/12/2015 1:51:49] [Error - Event::checkScript] Cannot load script (data/actions/scripts/vip/epicvip3.lua)

Postado

Actions

<action itemid="xxxx" script="vipdonat.lua"/> 

vipdonat.lua: (13778) storage, mude-a para desejada

function onUse(cid, item, fromPosition, itemEx, toPosition)
local config={
removeOnUse = "yes" -- remover quando usar ("yes" or "no")
}
local days = 30 -- dias que serão adicionados
local daysvalue = days * 24 * 60 * 60
local storageplayer = getPlayerStorageValue(cid, 13778)
local timenow = os.time()
if getPlayerStorageValue(cid, 13778) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storageplayer + daysvalue
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(cid, 13778, time)
local quantity = math.floor((getPlayerStorageValue(cid, 13778) - timenow)/(24 * 60 * 60))
doSendMagicEffect(getPlayerPosition(cid), math.random(28,30))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
if (config.removeOnUse == "yes") then
doRemoveItem(item.uid, 1)
db.executeQuery("UPDATE `players` SET `name` = '[VIP] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
doPlayerSendTextMessage(cid,25,"Você será kickado em 5 segundos para mudança de nome.")
doPlayerAddAddons(cid, 1)
addEvent(doRemoveCreature, 5*1000, cid, true)
end
return TRUE
end

creatureevents.xml add

<event type="login" name="FimVip" event="script" value="fimvip.lua"/>

fimvip.lua creatureevents/script

function onLogin(cid)
local temple = { x =160, y = 54, z = 7}
if vip.hasVip(cid) == true then
if getPlayerStorageValue(cid,13778) ~= 1 then
setPlayerStorageValue(cid,13778,1)
end
else
if getPlayerStorageValue(cid,13778) == 1 then
doTeleportThing(cid, temple)
doPlayerSendTextMessage(cid, 22, "Sua vip acabou!")
db.executeQuery("UPDATE `accounts` SET `vip_time` = 0 WHERE `id` = ".. getAccountIdByName(getPlayerName(cid)) ..";")
setPlayerPromotionLevel(cid, 1)
setPlayerStorageValue(cid, 13778, 0)
end
end
return true
end


function onLogin(cid)
local name = string.gsub(""..getCreatureName(cid).."", ".VIP. ", "")
if getPlayerStorageValue(cid, 13778) <= 0 then
if getCreatureName(cid) ~= name then
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` = "..getPlayerGUID(cid)..";")
addEvent(doRemoveCreature, 2*1000, cid, true)
end
end
return true
end

movements.xml 29859 (action id do piso que expulsará intrusos)

<movevent type="StepIn" actionid="29859" event="script" value="viptile.lua"/>

viptile.lua

function onStepIn(cid, item, position, fromPosition)
local config = {
msgDenied = "Este lugar é só para vips donate, adquira sua vip no site..",
msgWelcome = "Bem vindo a area vip, você tem 20% a mais de xp, bom up.."
}
if getPlayerStorageValue(cid, 13778) - 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

 

Creditos: alissonxzff2

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 519.6k

Informação Importante

Confirmação de Termo