Ir para conteúdo

Featured Replies

Postado

Andei pesquisando nos fóruns e não achei nada que me agradasse.

 

Gostaria de um sistema onde o player só pode passar em determinada porta quando ele tiver uma quantidade x de resets.

Também gostaria que a porta teleportasse o player para um tile à frente da porta.

Caso consigam algo do tipo, agradeço.

  • Respostas 8
  • Visualizações 1.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • tetheuscunha
    tetheuscunha

    Testa esse

  • Actions/Scripts ---------------------------------------------   function getReset(cid) local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid)) r

Postado

o reset é por storage? como q é? 

Scriptszinhos:

 

Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.

Postado
  • Autor
32 minutes ago, pablobion said:

o reset é por storage? como q é? 

 

Opa, o reset é por storage, é um NPC que vende resets:

 

local config = {
minlevel = 1000,
price = 1000000,
newlevel = 10,
priceByReset = 1000000,
percent = 100,
maxresets = 15,
levelbyreset = 1000
}

function getResets(uid)
resets = getPlayerStorageValue(uid, 378378)
  if resets < 0 then
            resets = 0
          end
return resets
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
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid


 function addReset(cid)
	if(npcHandler:isFocused(cid)) then
		npcHandler:releaseFocus(cid)
	end		
	talkState[talkUser] = 0
	resets = getResets(cid)
	setPlayerStorageValue(cid, 378378, resets+1) 
	doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	local hp = getCreatureMaxHealth(cid)
	local resethp = hp*(config.percent/100)
	setCreatureMaxHealth(cid, resethp)
	local differencehp = (hp - resethp)
	doCreatureAddHealth(cid, -differencehp)
	local mana = getCreatureMaxMana(cid)
	local resetmana = mana*(config.percent/100)
	setCreatureMaxMana(cid, resetmana)
	local differencemana = (mana - resetmana)
	doCreatureAddMana(cid, -differencemana)
    doRemoveCreature(cid)		
	local description = resets+1
    db.query("UPDATE `players` SET `description` = ' [Reset: "..description.."]' WHERE `players`.`id`= ".. playerid .."")
	db.query("UPDATE `players` SET `level`="..config.newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
    return true
end


local newPrice = config.price + (getResets(cid) * config.priceByReset)
local newminlevel = config.minlevel + (getResets(cid) * config.levelbyreset)

if msgcontains(msg, 'reset') then
	if getResets(cid) < config.maxresets then
		selfSay('You want to reset your character? It will cost '..newPrice..' gp\'s!', cid)
		talkState[talkUser] = 1
	else
		selfSay('You already reached the maximum reset level!', cid)
	end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
	if getPlayerMoney(cid) < newPrice then
		selfSay('Its necessary to have at least '..newPrice..' gp\'s for reseting!', cid)
	elseif getPlayerLevel(cid) < newminlevel then
		selfSay('The minimum level for reseting is '..newminlevel..'!', cid)
	else
		doPlayerRemoveMoney(cid,newPrice)
		playerid = getPlayerGUID(cid)
		addEvent(function()
			if isPlayer(cid) then
				addReset(cid)
			end
		end, 3000)
		local number = getResets(cid)+1
		local msg ="---[Reset: "..number.."]-- You have reseted! You'll be disconnected in 3 seconds."
		doPlayerPopupFYI(cid, msg) 
		talkState[talkUser] = 0
		npcHandler:releaseFocus(cid)
	end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no')) and isInArray({1}, talkState[talkUser]) == TRUE then
	talkState[talkUser] = 0
	npcHandler:releaseFocus(cid)
	selfSay('Ok.', cid)
elseif msgcontains(msg, 'quantity') then
	selfSay('You have a total of '..getResets(cid)..' reset(s).', cid)
	talkState[talkUser] = 0
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Postado
  • Autor

Caso ajude, consegui achar o script da porta, mas está sem o reset ainda.

 

function onUse(cid, item, frompos, item2, topos)
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Fique na frente da porta.')
return 1
end
reqlevel = item.actionid - 1000
if item.actionid > 0 and getPlayerLevel(cid) >= item.actionid - 1000 then
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,'Voce precisa de level ' .. reqlevel .. ' ou maior para passar nesta porta.') 

end
return 1
end

 

Postado

Testa esse

 

 

function onUse(cid, item, frompos, item2, topos)
pos = getPlayerPosition(cid)
if pos.x == topos.x then
if pos.y < topos.y then
pos.y = topos.y + 1
else
pos.y = topos.y - 1
end
elseif pos.y == topos.y then
if pos.x < topos.x then
pos.x = topos.x + 1
else
pos.x = topos.x - 1
end
else
doPlayerSendTextMessage(cid,22,'Fique na frente da porta.')
return 1
end
reset = reset
local reset = 8 -- quantidade de reset
if getPlayerStorageValue(cid, 378378) >= reset then
doTeleportThing(cid,pos)
doSendMagicEffect(topos,12)
else
doPlayerSendTextMessage(cid,22,'Voce precisa de reset ' .. reset .. ' ou maior para passar nesta porta.')

end
return 1
end

 

Editado por tetheuscunha (veja o histórico de edições)

Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo