when me or anyone rebirths it logs them off takes however much itt costs but no rebirth when they log back on
heres the script im using
npc
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rebirth NPC" script="data/npc/scripts/rebirth.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="143" head="39" body="122" legs="125" feet="57" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Im in charge of the rebirth system."/>
<parameter key="message_farewell" value="Good bye my dear friend."/>
</parameters>
</npc>
script
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)
npcHandlernCreatureAppear(cid)
end
function onCreatureDisappear(cid)
npcHandlernCreatureDisappear(cid)
end
function onCreatureSay(cid, type, msg)
npcHandlernCreatureSay(cid, type, msg)
end
function onThink()
npcHandlernThink()
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'rebirth')) then
selfSay('Are you ready to be reborn?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 600
local cost = 10000000
------/CONFIGS-------
-----LOCALS-----
local id = getPlayerGUID(cid)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
----/LOCALS-----
if getPlayerLevel(cid) >= level then
if doPlayerRemoveMoney(cid,cost) == TRUE then
if vocation == 5 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
elseif vocation == 6 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
elseif vocation == 7 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
elseif vocation == 8 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
else
selfSay('Please talk with forgotten king and promote first.', cid)
talkState[talkUser] = 0
end
else
selfSay('You dont have enough money. You need to pay 10000k to be rebirthed.', cid)
talkState[talkUser] = 0
end
else
selfSay('Only characters of level 600 or higher can be rebirthed.', cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then
selfSay('Okey come back when you are ready.', cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
heres the script im using
npc
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rebirth NPC" script="data/npc/scripts/rebirth.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="143" head="39" body="122" legs="125" feet="57" addons="3"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. Im in charge of the rebirth system."/>
<parameter key="message_farewell" value="Good bye my dear friend."/>
</parameters>
</npc>
script
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid)
npcHandlernCreatureAppear(cid)
end
function onCreatureDisappear(cid)
npcHandlernCreatureDisappear(cid)
end
function onCreatureSay(cid, type, msg)
npcHandlernCreatureSay(cid, type, msg)
end
function onThink()
npcHandlernThink()
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'rebirth')) then
selfSay('Are you ready to be reborn?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
-------CONFIGS-------
local level = 600
local cost = 10000000
------/CONFIGS-------
-----LOCALS-----
local id = getPlayerGUID(cid)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
----/LOCALS-----
if getPlayerLevel(cid) >= level then
if doPlayerRemoveMoney(cid,cost) == TRUE then
if vocation == 5 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
elseif vocation == 6 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
elseif vocation == 7 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
elseif vocation == 8 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = 8, `experience` = 4200, `promotion` = 1 WHERE `id` ='"..id.."';")
db.executeQuery("UPDATE `players` SET `name` = '"..name.."' WHERE `id` ='"..id.."';")
else
selfSay('Please talk with forgotten king and promote first.', cid)
talkState[talkUser] = 0
end
else
selfSay('You dont have enough money. You need to pay 10000k to be rebirthed.', cid)
talkState[talkUser] = 0
end
else
selfSay('Only characters of level 600 or higher can be rebirthed.', cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then
selfSay('Okey come back when you are ready.', cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())