Death Blower
I'm Ready.
- Joined
- Aug 19, 2011
- Messages
- 49
- Reaction score
- 3
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local t = {}
local level = 300000
local cost = 50000000
local prestige = 200
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
elseif msgcontains(msg, 'prestige') then
selfSay('Are you Ready to Prestige?', cid)
t[cid] = 1
elseif t[cid] == 1 then
npcHandler:releaseFocus(cid)
t[cid] = nil
if msgcontains(msg, 'yes') then
if getPlayerLevel(cid) >= level then
if getPlayerPromotionLevel(cid) ~= 0 then
if doPlayerRemoveMoney(cid, cost) then
doCreatureSetStorage(cid, prestige, math.max(0, getCreatureStorage(cid, prestige)) + 1)
local q = "UPDATE players SET level=20,experience=98800 WHERE id="..getPlayerGUID(cid)
npcHandler:releaseFocus(cid)
doRemoveCreature(cid)
db.executeQuery(q)
else
selfSay('You don\'t have enough money. You need to pay 5 Gold Ingot for me to Prestige you.', cid)
end
else
selfSay('Talk with the King of Redrum and purchase a promotion first.', cid)
end
else
selfSay('Only characters of level 300000 may be Prestiged.', cid)
end
else
selfSay('Alright, Come back when you wish to Prestige.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
I have this npc script for prestiging, i need this so if the player has 10 prestiges (storage 200=10) then he cant prestige anymore. Thanks to any1 who helps me .