Ir para conteúdo
  • 0

Marriage System


luanmax21

Pergunta

Ola galerinha estou aki para pedir suas ajudas para esse script pode inserir na tabela player coluna marriage adiciona o id marriage do player com quem ela casou e tambem que tirase caso se divorcia.

Origado.

 

 




marry_config = {
OnlyDifferentSex = true,
Marry_Price = 300000,
Divorce_Price = 100000,
Level = 8,
MaxSqm = 7, -- to marry
Text = {'I love you!','My love!','Baby dear!'},
RingID = 10502,
TimeAccept = 30,
storage1 = 300235,
storage2 = 300236,
storage3 = 300237
}

function isMarried(cid)
local m = db.getResult("SELECT `player_id` FROM `marriage_system` WHERE `player_id` = '"..getPlayerGUID(cid).."';")
if(m:getID() == -1) then
local e = db.getResult("SELECT `partner` FROM `marriage_system` WHERE `partner` = '"..getPlayerGUID(cid).."';")
if(e:getID() == -1) then
return false
end
end
return true
end
function isPatner(cid)
local p = db.getResult("SELECT `partner` FROM `marriage_system` WHERE `player_id` = '"..getPlayerGUID(cid).."';")
if(p:getID() == -1) then
return true
end
return false
end
function Ponline(player)
local rows = db.getResult("SELECT `online` FROM `players` WHERE `id` = " .. player .. ";")
local on = rows:getDataInt("online")
if on ~= 0 then
return TRUE
else
return FALSE
end
end
function getPartner(cid)
if isPatner(cid) then
a = db.getResult("SELECT `player_id` FROM `marriage_system` WHERE `partner` = '"..getPlayerGUID(cid).."';")
b = "player_id"
else
a = db.getResult("SELECT `partner` FROM `marriage_system` WHERE `player_id` = '"..getPlayerGUID(cid).."';")
b = "partner"
end
local query = a
return getPlayerNameByGUID(query:getDataString(b))
end
function doMarry(cid, patner)
return db.executeQuery("INSERT INTO `marriage_system` (`player_id`, `partner`, `marriage_date`) VALUES ('".. getPlayerGUID(cid) .."', '"..patner.."', '".. os.time() .."');")
end
function doDivorcePlayer(cid)
if isPatner(cid) then
pid,player = getPlayerGUIDByName(getPartner(cid)),getPlayerByNameWildcard(getPartner(cid))
else
pid,player = getPlayerGUID(cid),cid
end
return db.executeQuery("DELETE FROM `marriage_system` WHERE `player_id` = '" .. pid .. "';")
end
function getMarryDate(cid)
local player = isPatner(cid) and getPlayerGUIDByName(getPartner(cid)) or getPlayerGUID(cid)
local date = db.getResult("SELECT `marriage_date` FROM `marriage_system` WHERE `player_id` = '"..player.."';")
return os.date("%d %B %Y %X ", date:getDataInt("marriage_date"))
end
]]>
domodlib('marry_func')
param = string.lower(param)
if (param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"invalid command, for more information enter !marriage info")
elseif(param == "info") then
doShowTextDialog(cid,2160,"Casamento Info:\n\nLevel Minimo: "..marry_config.Level.."\nCasamento Custo: "..marry_config.Marry_Price.."\nDivorcio Custo: "..marry_config.Divorce_Price.."")
elseif(param == "status") then
doPlayerPopupFYI(cid,""..(isMarried(cid) and "Casamento Status".."\n\nCasado Com: "..getPartner(cid).."\n\nThe date of his marriage was: "..getMarryDate(cid).."" or "Voce nao e casado(a)").."")
end
return true
]]>
function onLogin(cid)
registerCreatureEvent(cid, "MarryLook")
registerCreatureEvent(cid, "MarryNoAttack")
return true
end]]>
domodlib('marry_func')
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and isMarried(thing.uid) then
doPlayerSetSpecialDescription(thing.uid,'.\n'..(getPlayerSex(thing.uid) == 0 and 'E' or 'E')..' casado com '..getPartner(thing.uid))
end
return true
end]]>
domodlib('marry_func')
if isPlayer(cid) and isPlayer(target) and isMarried(cid) and isMarried(target) then
if (getCreatureName(target) == getPartner(cid))then
doPlayerSendCancel(cid, "You may not attack this player.")
return false
end
end
return true
]]>

 

 

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0
  • Diretor

Não entendi muito bem...

 

Eu uso este NPC de casamento é muito bom, tem a opção de se casar e separar.

Só que não entendi muito bem o que você esta querendo

 

Bom de qualquer forma aqui está o sistema completo: http://www.xtibia.com/forum/topic/188712-marriage-system-npc/

Editado por nedroesdoksdja
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...