DestinationSer
@echo off
- Joined
- Mar 7, 2009
- Messages
- 2,806
- Solutions
- 1
- Reaction score
- 676
19:58 You see Xitis (-1 Prestiges) (Level 712308). He is a sorcerer. I dont want - there o.o i want it to be normal like (1 Prestiges) Also can you add the last 4 vocs too, the promotion vocs?
Answer fast.
Answer fast.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() 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('Ready for me to rebirth you?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
local level = 715000 -- Put here the level to rebirth
local cost = 0 -- Put here the cost to rebirth in GP (20000 = 20k)
local name = getCreatureName(cid)
local vocation = getPlayerVocation(cid)
local reborn = 100
local amountrebirth = getPlayerStorageValue(cid, reborn)
if getPlayerLevel(cid) >= level then
if(amountrebirth<=0) then
setPlayerStorageValue(cid, reborn, 0)
end
if doPlayerRemoveMoney(cid, cost) == TRUE then
setPlayerStorageValue(cid, reborn, amountrebirth +1)
if vocation == 1 then
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 1, promotion = 0, description = ' (" .. amountrebirth .. " Prestiges)' WHERE name ='"..name.."';")
elseif vocation == 2 then
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 2, promotion = 0, description = ' (" .. amountrebirth .. "Prestiges)' WHERE name ='"..name.."';")
elseif vocation == 3 then
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 3, promotion = 0, description = ' (" .. amountrebirth .. "Prestiges)' WHERE name ='"..name.."';")
elseif vocation == 4 then
doRemoveCreature(cid)
db.executeQuery("UPDATE players SET level = 8, experience = 4200, vocation = 4, promotion = 0, description = ' (" .. amountrebirth .. " Prestiges)' WHERE name ='"..name.."';")
else
selfSay('Not a valid vocation. Contact administrator.', cid)
talkState[talkUser] = 0
end
else
selfSay('You dont have enough money. You need to pay nothing to be rebirthed.', cid)
talkState[talkUser] = 0
end
else
selfSay('Only characters of level 715k or higher can be rebirthed.', cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then
talkState[talkUser] = 0
selfSay('Okey come back when you are ready.', cid)
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())