Ir para conteúdo

Featured Replies

Postado

ola, eu queria mt mt mt ajuda de vocês queria que vocês postasem um script aki de vip ou seja,

/addvip TEST, 10

dai quando o player passa na area vip mostrar a mensagem para ele ( Você tem 10 dias de vip restante )

me ajuda ai pessoal ou então pode c um script que clica no item é ganha tantos dias de vip vlw

Postado

Vamos nois:

Acesse a pasta data/lib copie la um arquivo.lua e renomeio para 049-vipsys.lua, após isso apague tudo dentro desse arquivo e adicione este coder:

vip = {

   name = "Vip system";

   author = "Mock";

   version = "1.0.0.0";

   query="ALTER TABLE `accounts` ADD `vip_time` INTEGER";

   query2="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL"

}


function vip.setTable()

   dofile('config.lua')

   if sqlType == "sqlite" then

   	db.executeQuery(vip.query)

   else

		db.executeQuery(vip.query2)

   end

end


function vip.getVip(cid)

		 assert(tonumber(cid),'Parameter must be a number')

		 if isPlayer(cid) == FALSE then error('Player don\'t find') end;

		 ae =  db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = '"..getPlayerAccount(cid).."';")

		 if ae:getID() == -1 then

			return 0

		 end


local retee = ae:getDataInt("vip_time") or 0

ae:free()

		 return retee

end


function vip.getVipByAcc(acc)

		 assert(acc,'Account is nil')

		 local a = db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = '"..acc.."';")

		 if a:getID() ~= -1 then

			 return a:getDataInt("vip_time") or 0, a:free()

		 else

			 error('Account don\'t find.')

		 end

end


function vip.setVip(cid,time)

		 dofile("config.lua")

		 assert(tonumber(cid),'Parameter must be a number')

		 assert(tonumber(time),'Parameter must be a number')

		 if isPlayer(cid) == FALSE then error('Player don\'t find') end;

		 db.executeQuery("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='".. getPlayerAccount(cid).."';")

end


function vip.getVipByAccount(acc)

		 assert(acc,'Account is nil')

		 return db.getResult("SELECT `vip_time` FROM `accounts` WHERE `name` = '"..acc.."';"):getDataInt("vip_time") or 0

end									  


function vip.hasVip(cid)

		 assert(tonumber(cid),'Parameter must be a number')

		 if isPlayer(cid) == FALSE then return end;

		 local t = vip.getVip(cid) or 0

		 if os.time(day) < t then

			return TRUE

		 else

			return FALSE

		 end

end


function vip.hasVips(cid)

		 assert(tonumber(cid),'Parameter must be a number')

		 if isPlayer(cid) == FALSE then return end;

		 local t = vip.getVip(cid)

		 if os.time(day) < t then

			return TRUE

		 else

			return FALSE

		 end

end


function vip.accountHasVip(acc)

		 assert(acc,'Account is nil')

		 if os.time() < vip.getVipByAccount(acc) then

			return TRUE

		 else

			return FALSE

		 end

end

function vip.getDays(days)

   return (3600 * 24 * days)

end


function vip.addVipByAccount(acc,time)

   assert(acc,'Account is nil')

   assert(tonumber(time),'Parameter must be a number')

   local a = vip.getVipByAcc(acc)

   a = os.difftime(a,os.time())

   if a < 0 then a = 0 end;

   a = a+time

   return vip.setVipByAccount(acc,a)

end


function vip.setVipByAccount(acc,time)

		 dofile("config.lua")

		 assert(acc,'Account is nil')

		 assert(tonumber(time),'Parameter must be a number')

		 db.executeQuery("UPDATE `accounts` SET `vip_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';")

		 return TRUE

end


function vip.returnVipString(cid)

   assert(tonumber(cid),'Parameter must be a number')

   if isPlayer(cid) == TRUE then

	  return os.date("%d %B %Y %X ", vip.getVip(cid))

   end

end
Abra a pasta data/creaturescrpits/scripts copie la um arquivo.lua e renomeio para vip.lua, dentro dele adicione: By Lukeskywalker
function onLogin(cid)

	local temple = { x =32369, y = 32246, z = 6}

	if vip.hasVip(cid) == true then

		if getPlayerStorageValue(cid,55555) ~= 1 then

			setPlayerStorageValue(cid,55555,1)

		end

	else

		if getPlayerStorageValue(cid,55555) == 1 then

			doTeleportThing(cid, temple)

			doPlayerSendTextMessage(cid, 22, "Your VIP Time over!")

			db.executeQuery("UPDATE `accounts` SET `vip_time` = 0 WHERE `id` = ".. getAccountIdByName(getPlayerName(cid)) ..";")

			setPlayerPromotionLevel(cid, 1)

			setPlayerStorageValue(cid, 55555, 0)

		end

	end

	return true

end
Você pode troca as coordenadas do templo: local temple = {x=32369, y=32246, z=6}. Em data/creaturescripts/scripts/login.lua adicione essas tags:
		registerCreatureEvent(cid, "FimVip")

		registerCreatureEvent(cid, "VipReceive")
Em data/creaturescripts/creaturescripts.xml adicione está tag:
	<event type="login" name="FimVip" event="script" value="vip.lua"/>
Em data\movements\scripts copie la um arquivo.lua e renomeio para viptile.lua e adicione este coder dentro do mesmo:
function onStepIn(cid, item, position, fromPosition)


local tileConfig = {

	kickPos = fromPosition, kickEffect = CONST_ME_POFF,

	kickMsg = "You need to be a vip player to access this area.",

	enterMsg = "Welcome to vip area!",

	enterEffect = CONST_ME_MAGIC_RED,

}


if isPlayer(cid) == true then  

if vip.hasVip(cid) == FALSE then

		doTeleportThing(cid, tileConfig.kickPos)

		doSendMagicEffect(tileConfig.kickPos, tileConfig.kickEffect)

		doPlayerSendCancel(cid, tileConfig.kickMsg)

		return

	end

		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, tileConfig.enterMsg)

		doSendMagicEffect(position, tileConfig.enterEffect)

		return true

end

end
Em data\movements\movements.xml adicione a tag:
	<movevent type="StepIn" actionid="13500" event="script" value="viptile.lua"/>
Vejam a numeração 13500 você irá usar no tile que você quer para a passagem de player VIP para configurar adicione a numeração em ActionID do tile. Em data/talkactions/scripts acrecente dentro da pasta scripts uma outra pasta com o nome VIP vamos precisar de 7 arquivos.lua quem teram os nomes e coder a seguir: add.lua
function onSay(cid, words, param, channel)

doPlayerSendCancel(cid, "Added "..param.." Vip Days.")

return doPlayerAddVipDays(cid, param)

end
addvipp.lua
function onSay(cid, words, param)

		 if param == "" then

			return  doPlayerPopupFYI(cid,"Está com problemas?\nAprenda os comandos!\n---------------\nAdicionar vip:\n/vip add days player\n/vip add 30 Real\n---------------\nDeletar vip:\n/vip del player\n/vip del Real\n---------------\nVer a vip:\n/vip see player\n/vip see Real\n---------------\n")

		 end

		 if param:lower():find('add') == 1 and 3 then

			local _,_,id,name = param:lower():find('add (%d+) (.+)')

			name = name or ""

			id = tonumber(id or 1) or 1

			if tonumber(id) == nil or getPlayerByName(name) == false then

			   return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Adicionar vip:\n/vip add days player\n/vip add 30 Real\n [Player: "..name.."]")

			end  

			if isPlayer(getPlayerByName(name)) == TRUE then

			vip.addVipByAccount(getPlayerAccount(getPlayerByName(name)) ,vip.getDays(id))


			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Foram adicionados "..tonumber(id).." dias de vip a "..name..".")

			doPlayerSendTextMessage(getPlayerByName(name),MESSAGE_INFO_DESCR,"Você recebeu "..tonumber(id).." dias de vip.")

		 else

		   doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,name.." não esta online ou não existe.")

		 end

		 elseif param:lower():find('del') == 1 and 3 then

			local _,_,name = param:lower():find('del (.+)')

			if getPlayerByName(name) == false then

			   return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Deletar vip:\n/vip del player\n/vip del Real\n")

			end


			vip.setVipByAccount(getPlayerAccount(getPlayerByName(name)),-os.time())

			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"A vip de "..name.." foi apagada.")																																			  

		 elseif param:lower():find('see') == 1 and 3 then

			local _,_,name = param:lower():find('see (.+)')

			name = name or ""

			if getPlayerByName(name) == false then

			   return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"Ver a vip:\n/vip see player\n/vip see Real\n")

			end

			local ret_ = vip.getVip(getPlayerByName(name))

			if ret_ == 0 then

			  return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,name.." Não tem vip, e nunca teve.")

			else

			  return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "A vip de "..name.." Acaba/terminou em "..os.date("%d %B %Y %X ",ret_))

			end

		 end

		 return TRUE

end
get.lua
function onSay(cid, words, param, channel)

	doPlayerSendCancel(cid, ""..getPlayerVipDays(cid).." days VIP left.")

end
is.lua
function onSay(cid, words, param, channel)

	if isPlayerVip(cid) == TRUE then

		doPlayerSendCancel(cid, "You are a VIP player.")

	else

		doPlayerSendCancel(cid, "You are not a VIP player.")

	end	

end
removevip.lua
function onSay(cid, words, param, channel)

	doPlayerSendCancel(cid, "Vip removed.")

	return doPlayerRemoveVip(cid)

end
set.lua
function onSay(cid, words, param, channel)

	doPlayerSendCancel(cid, "VIP Days: "..param..".")

	return setPlayerVipDays(cid, param)

end
vipdays.lua
function onSay(cid, words, param)

		 if vip.hasVip(cid) == TRUE then

			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your vip end in "..os.date("%d %B %Y %X ",vip.getVip(cid)))

		 else

			 if vip.getVip(cid) ~= 0 then

				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You're not a vip player. Your vip has finished in "..os.date("%d %B %Y %X ", vip.getVip(cid)).." and now is "..os.date("%d %B %Y %X ", os.time()))

			 else

				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You're not a vip player. You naver has a vip.")

			 end

		 end

		 return TRUE

end
Em data/talkactions/talkactions.xml adicione está tag:
	<!-- VIP System -->

	<talkaction log="yes" words="/vip" access="5" event="script" value="VIP/addvipp.lua" />

	<talkaction words="!vipdays" event="script" value="VIP/vipdays.lua" />
Para finalizar execute este comando na sua database:
alter table `accounts` add `vip_time` INT NOT NULL; 

Bom galera fim este sistema vip adiciona os dias corretos e ao termino do VIP o player recebe a menssagem que o VIP acabou é teleportado pro templo porque se no caso ele estiver na área VIP essa é uma saida e zera a coluna vip_time.

-------------

espero ter ajudado

Creditos:

Mock

Lukeskywalker

Natan Beckman

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

Se lhe ajudei Rep+ me

^^

Atenciosamente: Itroxz

gordinho-matador-fail.gif

wX9E4.png

Mapper~~

  • 2 years later...
Postado

eu começei faz pouco tempo mexer com script, eu uso sql no meu ot, entao eu coloco " alter table `accounts` add `vip_time` INT NOT  NULL; " no sql ao invez do mysql ?

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