drama4day
New Member
- Joined
- Feb 17, 2011
- Messages
- 44
- Reaction score
- 0
this i get from xtibia.com
and who help me to fixed
View Profile: Limos - OtLand
and thanks so much for she
i wright this post cuz i search more and i dont find it
who creat script emails on script
how to setup
first cread file
and put on its this code
V
scound goto
mods/scripts/
and creat new folder with name
and creat 5 new arcech with .lua
and put on it
1: add_vip.lua
2:vip_check.lua
3:vip_medal.lua
4:vip_install
5: vip_tile
the end i love to help people cuz if i need help people will help me thanks for reading
and who help me to fixed
View Profile: Limos - OtLand
and thanks so much for she
i wright this post cuz i search more and i dont find it
who creat script emails on script
how to setup
first cread file
Code:
vip_sys.xml
and put on its this code
V
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="vip_sys" version="4.0" author="Luke sky walker" contact="[email protected]" enabled="yes">
<config name="Rook_Config"><![CDATA[
RookSistem = "no"
RookTempleID = 1
MainTempleID = 2
]]></config>
<config name="Vip_Libs"><![CDATA[
function getResetTemple(cid)
local Query = db.getResult("SELECT `reset_temple` FROM `players` WHERE `players`.`id` = ".. getPlayerGUID(cid) ..";")
return (isPlayer(cid) == true and (Query:getDataInt("reset_temple") == 1)) and true or false
end
function isVip(cid)
local Query = db.getResult("SELECT `vip` FROM `accounts` WHERE `accounts`.`id` = ".. getPlayerAccountId(cid) ..";")
return (isPlayer(cid) == true and (Query:getDataInt("vip") == 1)) and true or false
end
function getVipTimeByName(Name)
local Query = db.getResult("SELECT `vip_time` FROM `accounts` WHERE `accounts`.`id` = ".. getAccountIdByName(Name) ..";")
return Query:getDataInt("vip_time")
end
function getVipDays(cid)
local Query = db.getResult("SELECT `vip_days` FROM `accounts` WHERE `accounts`.`id` = ".. getPlayerAccountId(cid) ..";")
return Query:getDataInt("vip_days")
end
]]></config>
<action itemid="9653" event="script" value="vip_sys/vip_medal.lua"/>
<talkaction words="/addvip" access="5" event="script" value="vip_sys/add_vip.lua"/>
<globalevent name="vip_sys" type="startup" event="script" value="vip_sys/vip_install.lua"/>
<globalevent name="vip_check" interval="5000" event="script" value="vip_sys/vip_check.lua"/>
<movevent type="StepIn" actionid="7777" event="script" value="vip_sys/vip_tile.lua"/>
<event type="login" name="vip_login" event="script" value="vip_sys/vip_login.lua"/>
</mod>
scound goto
mods/scripts/
and creat new folder with name
Code:
vip_sys
and creat 5 new arcech with .lua
and put on it
1: add_vip.lua
Code:
function onSay(cid, words, param, channel)
domodlib('Vip_Libs')
local Data = string.explode(param, ",")
if (words:sub(2, 2) == "a") then
if (not Data[1]) then
doPlayerSendCancel(cid, "Insira um nome.")
return true
elseif (not Data[2] or Data[2] == "") then
doPlayerSendCancel(cid, "Insira a quantidade de dias de vip que vai adionar ao player.")
return true
elseif not isNumber(Data[2]) then
doPlayerSendCancel(cid, "Use apenas numeros.")
return true
end
local AccID = getAccountIdByName(Data[1])
if (AccID > 0) then
if (getPlayerByName(Data[1])) then
doSendMagicEffect(getCreaturePosition(getPlayerByName(Data[1])), CONST_ME_MAGIC_GREEN)
end
if getVipTimeByName(Data[1]) == 0 then
db.executeQuery("UPDATE `accounts` SET `vip_time` = 86400 * ".. Data[2] .." + ".. os.time() .." WHERE `accounts`.`id` = ".. AccID ..";")
else
db.executeQuery("UPDATE `accounts` SET `vip_time` = `accounts`.`vip_time` + (86400 * ".. Data[2] ..") WHERE `accounts`.`id` = ".. AccID ..";")
end
db.executeQuery("UPDATE `accounts` SET `vip` = 1 WHERE `accounts`.`id` = ".. AccID ..";")
db.executeQuery("UPDATE `accounts` SET `vip_days` = `accounts`.`vip_days` + ".. Data[2] .." WHERE `accounts`.`id` = ".. AccID ..";")
if Data[2] == '0' then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Nenhum dia de vip foi adicionado a conta ".. getAccountByName(Data[1]) ..".")
elseif Data[2] > '1' then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foi adicionado ".. Data[2] .." dias de vip a conta ".. getAccountByName(Data[1]) ..".")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foi adicionado 1 dia de vip a conta ".. getAccountByName(Data[1]) ..".")
end
else
doPlayerSendCancel(cid, "O player ".. Data[1] .." não existe.")
end
else
if getVipDays(cid) == 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não é um jogador vip.")
elseif getVipDays(cid) > 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. getVipDays(cid) .." dias de vip.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem 1 dia de vip.")
end
end
return true
end
2:vip_check.lua
Code:
function onThink(interval)
Query = db.getResult("SELECT `id`, `name`, `vip_days`, `vip_time` FROM `accounts` WHERE `accounts`.`vip` = 1")
if(Query:getID() == -1) then
return true
end
for i = 1, Query:getRows() do
local AccID = Query:getDataInt("id")
local AccName = Query:getDataInt("name")
local VipDays = Query:getDataInt("vip_days")
local VipTime = Query:getDataInt("vip_time")
if VipTime >= os.time() then
if VipDays ~= math.ceil((VipTime - os.time()) / 86400) then
db.executeQuery("UPDATE `accounts` SET `vip_days` = ".. math.ceil((VipTime - os.time()) / 86400) .." WHERE `accounts`.`id` = ".. AccID ..";")
if math.ceil((VipTime - os.time()) / 86400) == 1 then
print("A conta ".. AccName .." tem ".. math.ceil((VipTime - os.time()) / 86400) .." dia de vip restante")
else
print("A conta ".. AccName .." tem ".. math.ceil((VipTime - os.time()) / 86400) .." dias de vip restantes")
end
end
else
db.executeQuery("UPDATE `accounts` SET `vip_time` = 0 WHERE `accounts`.`id` = ".. AccID ..";")
db.executeQuery("UPDATE `accounts` SET `vip_days` = 0 WHERE `accounts`.`id` = ".. AccID ..";")
db.executeQuery("UPDATE `accounts` SET `vip` = 0 WHERE `accounts`.`id` = ".. AccID ..";")
db.executeQuery("UPDATE `players` SET `reset_temple` = 1 WHERE `players`.`account_id` = ".. AccID ..";")
print("A vip da conta ".. AccName .." acabou.")
end
Query:next()
end
Query:free()
return true
end
3:vip_medal.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
domodlib('Vip_Libs')
local AddVipDays = 15
if getVipDays(cid) > 365 then
doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.")
else
local AccID = getPlayerAccountId(cid)
if getVipDays(cid) == 0 then
db.executeQuery("UPDATE `accounts` SET `vip_time` = 86400 * ".. AddVipDays .." + ".. os.time() .." WHERE `accounts`.`id` = ".. AccID ..";")
db.executeQuery("UPDATE `accounts` SET `vip` = 1 WHERE `accounts`.`id` = ".. AccID ..";")
else
db.executeQuery("UPDATE `accounts` SET `vip_time` = `accounts`.`vip_time` + (86400 * ".. AddVipDays ..") WHERE `accounts`.`id` = ".. AccID ..";")
end
doPlayerPopupFYI(cid, "We have added 15 vip days to your account!\nEnjoy it!.")
doRemoveItem(item.uid)
end
return true
end
4:vip_install
Code:
function onStartup()
local Query = db.getResult("SELECT `config`, `value` FROM `server_config` WHERE `server_config`.`config` = 'vip_sys';")
if(Query:getID() == -1) then
local Install_Query =
{
mysql =
{
"ALTER TABLE `accounts` ADD `vip` TINYINT NOT NULL DEFAULT '0' AFTER `premdays`;",
"ALTER TABLE `accounts` ADD `vip_days` INT NOT NULL DEFAULT '0' AFTER `vip`;",
"ALTER TABLE `accounts` ADD `vip_time` INT NOT NULL DEFAULT '0' AFTER `vip_days`;",
"ALTER TABLE `players` ADD `reset_temple` TINYINT NOT NULL DEFAULT '0' AFTER `town_id`;",
"INSERT INTO `server_config` (`config`, `value`) VALUES ('vip_sys', 1);"
},
sqlite =
{
"ALTER TABLE `accounts` ADD `vip` INTEGER NOT NULL DEFAULT 0;",
"ALTER TABLE `accounts` ADD `vip_days` INTEGER NOT NULL DEFAULT 0;",
"ALTER TABLE `accounts` ADD `vip_time` INTEGER NOT NULL DEFAULT 0;",
"ALTER TABLE `players` ADD `reset_temple` INTEGER NOT NULL DEFAULT 0;",
"INSERT INTO `server_config` VALUES ('vip_sys', 1);"
}
}
print(">> Instalando vip_sys...")
print(">> Verificando tipo de banco de dados...")
print(">> Tipo do banco de dados ".. getConfigValue('sqlType') .."...")
if getConfigValue('sqlType') == "mysql" then
for i = 1, #Install_Query.mysql do
print(">> ".. Install_Query.mysql[i] .."")
db.executeQuery(Install_Query.mysql[i])
end
elseif getConfigValue('sqlType') == "sqlite" then
for i = 1, #Install_Query.sqlite do
print(">> ".. Install_Query.sqlite[i] .."")
db.executeQuery(Install_Query.sqlite[i])
end
else
print(">> Banco de dados ".. getConfigValue('sqlType') .." sem suporte ao sistema vip_sys")
end
print(">> vip_sys instalado e operando...")
return true
end
local Config = Query:getDataString("config")
local Value = Query:getDataInt("value")
if Value == 1 then
print(">> Sistema vip funcionando e atualizado...")
end
return true
end
5: vip_tile
Code:
local function vipPushBack(cid, position, fromPosition, displayMessage)
doTeleportThing(cid, fromPosition, true)
doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
if(displayMessage) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Está zona so jogadores VIP podem entrar.")
end
end
function onStepIn(cid, item, position, fromPosition)
domodlib('Vip_Libs')
if (isVip(cid) == false) then
vipPushBack(cid, position, fromPosition, true)
end
end
the end i love to help people cuz if i need help people will help me thanks for reading