login.lua
-- Author: David
-- Country: Brazil
-- Email:
[email protected]
function onLogin(cid)
-- Verificar Outfit Bugado
resultdb = mysqlQuery("SELECT `looktype` FROM `players` WHERE `name` = \"" .. getPlayerName(cid) .. "\"", "looktype")
getlooktype = resultdb.looktype
if getlooktype <= "0" then
if getPlayerSex(cid) == 0 then
doCreatureChangeOutfit(cid,{lookType = 267})
else
doCreatureChangeOutfit(cid,{lookType = 258})
end
doPlayerSendTextMessage(cid, 18, "Something unexpected happened with your outfit and it had to be reset!")
end
-- Checar Promotion e Bless
CheckPlayerBlessings(cid)
CheckPlayerPromotion(cid)
-- Remover Bless se necessário
registerCreatureEvent(cid, "PlayerDeath")
registerCreatureEvent(cid, "onKill")
if getPlayerStorageValue(cid, 30007) == 1 then
RemovePlayerBlessing(cid)
setPlayerStorageValue(cid, 30007, -1)
end
-- Primeiros Itens
local firstItems = {2050,2382}
if getPlayerStorageValue(cid, 30001) == -1 then
for i = 1, table.maxn(firstItems) do
doPlayerAddItem(cid, firstItems[i], 1)
end
if getPlayerSex(cid) == 0 then
doPlayerAddItem(cid, 2651, 1)
else
doPlayerAddItem(cid, 2650, 1)
end
local bag = doPlayerAddItem(cid, 1987, 1)
doAddContainerItem(bag, 2674, 1)
setPlayerStorageValue(cid, 30001, 1)
end
-- Teleport para cidade free quando premium acabar (MAIN)
local templo = {x=32369, y=32241, z=7}
if isPremium(cid) == TRUE then
if getPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT) == -1 then
setPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT, 1)
end
elseif isPremium(cid) == FALSE then
if getPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT) == 1 and getPlayerVocation(cid) >= 1 then
setPlayerStorageValue(cid, STORAGE_PREMIUM_ACCOUNT, -1)
doPlayerSetTown(cid, 3)
doTeleportThing(cid, templo)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You have been teleported to Thais. Your premium has been expired!")
end
end
return TRUE
end
bless_system.lua
-- Author: Rodrigo (Nottinghster) - (OTLand, OTFans, XTibia, OTServBR)
-- Country: Brazil
-- From: Tibia World RPG OldSchool
-- Email:
[email protected]
-- Compiler: Tibia World Script Maker (Libs Scripts)
function CheckPlayerBlessings(cid)
if isPromoted(cid) == TRUE then
deathlossvalue = 7
else
deathlossvalue = 10
end
local MGB = mysqlQuery("SELECT `bless1`, `bless2`, `bless3`, `bless4`, `bless5` FROM `players` WHERE `name` = '" .. getPlayerName(cid) .. "';", "bless1, bless2, bless3, bless4, bless5")
if(MGB.bless1) == "1" then
blessone = 1
else
blessone = 0
end
if(MGB.bless2) == "1" then
blesstwo = 1
else
blesstwo = 0
end
if(MGB.bless3) == "1" then
blessthree = 1
else
blessthree = 0
end
if(MGB.bless4) == "1" then
blessfour = 1
else
blessfour = 0
end
if(MGB.bless5) == "1" then
blessfive = 1
else
blessfive = 0
end
FINISHEDDEATHLOSS = (deathlossvalue-((((blessone+blesstwo)+blessthree)+blessfour)+blessfive))
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, FINISHEDDEATHLOSS)
doPlayerSetLossPercent(cid, PLAYERLOSS_MANA, FINISHEDDEATHLOSS)
doPlayerSetLossPercent(cid, PLAYERLOSS_SKILL, FINISHEDDEATHLOSS)
return true
end
function RemovePlayerBlessing(cid)
mysqlQuery("UPDATE `players` SET `bless1` = '0',`bless2` = '0',`bless3` = '0',`bless4` = '0',`bless5` = '0' WHERE `name` = \"" .. getPlayerName(cid) .. "\"", "SET")
return true
end
function AddPlayerBlessing(cid, type)
local MGB = mysqlQuery("SELECT `bless1`, `bless2`, `bless3`, `bless4`, `bless5` FROM `players` WHERE `name` = '" .. getPlayerName(cid) .. "';", "bless1, bless2, bless3, bless4, bless5")
if type == 1 then
if (MGB.bless1) == "0" then
mysqlQuery("UPDATE `players` SET `bless1` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
CheckPlayerBlessings(cid)
return true
else
return false
end
elseif type == 2 then
if (MGB.bless2) == "0" then
mysqlQuery("UPDATE `players` SET `bless2` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
CheckPlayerBlessings(cid)
return true
else
return false
end
elseif type == 3 then
if (MGB.bless3) == "0" then
mysqlQuery("UPDATE `players` SET `bless3` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
CheckPlayerBlessings(cid)
return true
else
return false
end
elseif type == 4 then
if (MGB.bless4) == "0" then
mysqlQuery("UPDATE `players` SET `bless4` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
CheckPlayerBlessings(cid)
return true
else
return false
end
elseif type == 5 then
if (MGB.bless5) == "0" then
mysqlQuery("UPDATE `players` SET `bless5` = '1' WHERE `name` = '" .. getPlayerName(cid) .. "';", "SET")
CheckPlayerBlessings(cid)
return true
else
return false
end
end
end