• 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!

Help with this NPC pls

Stewie

Family Guy # ;3
Joined
May 3, 2010
Messages
786
Reaction score
12
Location
TV
Hi, this NPC is for reset,i would like

1° reset = lv 3000 - for VIP 1° reset = lv 2800
2° reset = lv 3500 - for VIP 2° reset = lv 3300
3° reset = lv 4000 - for VIP 3° reset = lv 3800
......

here the script :

LUA:
-- SCRIPT FEITO POR YUNIE
-- config
local minlevel = 4000 -- level para resetar
local minlevel_vip = 3500
local price = 100000000
local newlevel = 10 -- level após reset
local newexp = 9300 -- nova experiencia após reset
-- end config

function addReset(cid)
	return setPlayerStorageValue(cid, 36874, getResets(cid) + 1)
end

function getResets(cid)
	return math.max(0, getPlayerStorageValue(cid, 36874))
end

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

	if msgcontains(msg, 'resetar') then
		selfSay('Voce aceita o reset? se voce confirmar tera que deslogar para que o reset tenha efeito. voce tera que pagar a quantia de '..price..' GP para o reset.', cid)
		talkState[cid] = 1
	elseif(msgcontains(msg, 'yes') and talkState[cid] == 1) then
		if getPlayerMoney(cid) < price then
			selfSay('You must pay '..price..' gold coins to reset.', cid)
		elseif getPlayerLevel(cid) < (getPlayerVipDays(cid) >= 1 and minlevel_vip or minlevel) then
			selfSay('Voce precisa ter no minimo level '.. minlevel ..' para o reset.', cid)
		else
			doPlayerRemoveMoney(cid,price)
			addReset(cid)
			playerid = getPlayerGUID(cid)
			doRemoveCreature(cid)
			db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`="..newexp.." WHERE `players`.`id`= ".. playerid .."")
		end
		talkState[cid] = 0
	elseif msgcontains(msg, 'no') and isInArray({1}, talkState[cid]) then
		talkState[cid] = 0
		selfSay('Yes', cid)
	elseif msgcontains(msg, 'resets') then
		selfSay('Voce tem '..getResets(cid)..' reset(s).', cid)
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
LUA:
-- SCRIPT FEITO POR YUNIE
-- config
local price = 100000000
local newlevel = 10 -- level após reset
-- end config
 
function addReset(cid)
	return setPlayerStorageValue(cid, 36874, getResets(cid) + 1)
end
 
function getResets(cid)
	return math.max(0, getPlayerStorageValue(cid, 36874))
end
 
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
	elseif msgcontains(msg, 'resetar') then
		selfSay('Voce aceita o reset? se voce confirmar tera que deslogar para que o reset tenha efeito. voce tera que pagar a quantia de '..price..' GP para o reset.', cid)
		talkState[cid] = 1
	elseif talkState[cid] == 1 then
		if msgcontains(msg, 'yes') then
			if getPlayerMoney(cid) < price then
				selfSay('You must pay '..price..' gold coins to reset.', cid)
			else
				local n  = getResets(cid) * 500 + (getPlayerVipDays(cid) > 0 and 2800 or 3000)
				if getPlayerLevel(cid) < n then
					selfSay('Voce precisa ter no minimo level '.. n ..' para o reset.', cid)
				else
					doPlayerRemoveMoney(cid, price)
					addReset(cid)
					local playerid = getPlayerGUID(cid)
					doRemoveCreature(cid)
					db.executeQuery('UPDATE `players` SET `level`='..newlevel..',`experience`='..getExperienceForLevel(newlevel)..' WHERE `id`= '.. playerid ..' LIMIT 1;')
				end
			end
			talkState[cid] = nil
		else
			selfSay('Then not.', cid)
		end
	elseif msgcontains(msg, 'resets') then
		local n = getResets(cid)
		selfSay('Voce tem ' .. n .. ' reset' .. (n == 1 and '' or 's') .. '.', cid)
		talkState[cid] = nil
	end
 
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top