• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Max Prestige Npc, Help

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 :D.
 
try this
Lua:
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 getCreatureStorage(cid, 200) < 10 then
				doCreatureSetStorage(cid, 200, math.max(0, getCreatureStorage(cid, reborn)) + 1)
				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())
 
Thanks Amiroslo, but theres an error.
Code:
[21/02/2012 12:45:24] [Error - LuaScriptInterface::loadFile] data/npc/scripts/prestige.lua:53: 'end' expected (to close 'function' at line 16) near '<eof>'
[21/02/2012 12:45:24] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/prestige.lua
[21/02/2012 12:45:24] data/npc/scripts/prestige.lua:53: 'end' expected (to close 'function' at line 16) near '<eof>'
 
try this
Lua:
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()	
 
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 getCreatureStorage(cid, 200) < 10 then
				doCreatureSetStorage(cid, 200, math.max(0, getCreatureStorage(cid, reborn)) + 1)
				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())
 
Damn, sorry again:
Code:
[21/02/2012 12:52:13] [Error - LuaScriptInterface::loadFile] data/npc/scripts/prestige.lua:53: 'end' expected (to close 'function' at line 16) near '<eof>'
[21/02/2012 12:52:13] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/prestige.lua
[21/02/2012 12:52:13] data/npc/scripts/prestige.lua:53: 'end' expected (to close 'function' at line 16) near '<eof>'
 
now
Lua:
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 getCreatureStorage(cid, 200) < 10 then
				doCreatureSetStorage(cid, 200, math.max(0, getCreatureStorage(cid, reborn)) + 1)
				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())
 
try this
Lua:
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 greetCallback(cid)
	Topic[cid] = nil
	return true
end
 
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
			elseif Topic[cid] then
	if 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 getCreatureStorage(cid, 200) < 10 then
				doCreatureSetStorage(cid, 200, math.max(0, getCreatureStorage(cid, reborn)) + 1)
				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())
 
error but different 0o:
[21/02/2012 13:03:55] [Error - LuaScriptInterface::loadFile] data/npc/scripts/prestige.lua:59: 'end' expected (to close 'if' at line 22) near '<eof>'
[21/02/2012 13:03:55] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/prestige.lua
[21/02/2012 13:03:55] data/npc/scripts/prestige.lua:59: 'end' expected (to close 'if' at line 22) near '<eof>'
 
try this
Lua:
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 getCreatureStorage(cid, 200) < 10 then
				doCreatureSetStorage(cid, 200, math.max(0, getCreatureStorage(cid, reborn)) + 1)
				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())
 
[21/02/2012 13:37:32] [Error - LuaScriptInterface::loadFile] data/npc/scripts/prestige.lua:54: 'end' expected (to close 'function' at line 17) near '<eof>'
[21/02/2012 13:37:32] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/prestige.lua
[21/02/2012 13:37:32] data/npc/scripts/prestige.lua:54: 'end' expected (to close 'function' at line 17) near '<eof>'
 
HOLY SHAZ it worx! Thanks a crapload Amir, ill let you know if theres something wrong with it.
 
Well i tested every script he posted here and all of them worked so what ever rev you have it must be buggy as sh*t tbh mate so also if you ask what rev im using its "0.4_DEV" trunk 3884
 
Back
Top