Ir para conteúdo

Featured Replies

Postado

Boa noite pessoal,

Estou com o seguinte erro, o npc de cassino que estou usando ele funciona certinho da PRIMEIRA VEZ QUE O JOGA COM  ELE, porem quando o player volta ele n faz as perguntas e aparece este erro na distro.

Mostrar conteúdo oculto

E aqui está o script do cassino

Mostrar conteúdo oculto

Por favor alguém poderia me ajudar?

Obs utilizo otx 2 - 8.60

  • Respostas 16
  • Visualizações 883
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • DigoleraBlow
    DigoleraBlow

    @Vodkart Continua com o mesmo erro, engraçado que ele funciona certinho da primeira vez que o player joga com ele. Na segunda vez que o player volta para jogar novamente ele até gira o dado tudo mais 

  • DigoleraBlow
    DigoleraBlow

    @Vodkart Agora está dando este erro, a principio o mesmo erro do começo... [Error - NpcScript Interface] data/npc/scripts/cassino.lua:onThink Description: (LuaInterface::luaGetCreatureStora

Postado
local talkState = {}
local focus, old_focus = 0, 0 
local dice_pos = {x=32465,y=32497,z=7,stackpos=255}
local player_pos = {x=32464,y=32499,z=7}
local nme = "Dice"
function msgcontains(txt, str) 
	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) 
end 
function onCreatureSay(cid, type, msg) 
	local msg = string.lower(msg) 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid 

	local function rollDice(cid,ammount)
		local value = math.random(5792, 5797)

		local item = getThingFromPos(dice_pos)
		if item and item.uid and item.uid > 0 and item.itemid >= 5792 and item.itemid <= 5797 then

			doTransformItem(item.uid, value)

		end
		doSendMagicEffect(dice_pos, CONST_ME_CRAPS)
		local rolled = value - 5791
		doCreatureSay(getNpcId(), getCreatureName(getNpcId()) .. ' rolled a ' .. rolled .. '.', TALKTYPE_ORANGE_1)
		if rolled == ammount then
			local backpack = doCreateItemEx(10521)
	   		doAddContainerItem(backpack,12627,3)
	   		doAddContainerItem(backpack,12626,3)
	   		doAddContainerItem(backpack,5957,1)
	   		doAddContainerItem(backpack,10310,1)
	   		doPlayerAddItemEx(cid,backpack)
	   		doSendMagicEffect(getThingPos(cid),29)
	   		doCreatureSay(cid,gm(cid,nme,1),TALKTYPE_ORANGE_1)
	   	else
	   		doCreatureSay(cid,gm(cid,nme,2),TALKTYPE_ORANGE_1)
	   		doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
	   	end
	   	addEvent(function()
            if not isCreature(cid) then return LUA_ERROR end
	   		doPlayerSetStorageValue(cid,722522,-1)
	   		doTeleportThing(cid,{x=165,y=59,z=7})
	   	end,2000)
	end

 
	if isInArray({1,2,3,4,5,6},tonumber(msg)) and focus == cid then
		local storage = getPlayerStorageValue(cid,722522)
		if storage == -1 then
			doPlayerSetStorageValue(cid,722522,1)
			rollDice(cid,tonumber(msg))
		end
	end 
end

function onThink()
	local player = getTopCreature(player_pos)
	if player and player.uid and player.uid > 0 and isPlayer(player.uid) then
		if focus ~= player.uid then
			focus = player.uid
			selfSay(gm(cid,nme,3).." "..getCreatureName(player.uid)..".")
			addEvent(function()
			if not isCreature(player.uid) then return LUA_ERROR end
				if isPlayer(player.uid) then
					doSendMagicEffect(getThingPos(player.uid),CONST_ME_POFF)
					doPlayerSetStorageValue(player.uid,722522.-1)
					doTeleportThing(player.uid,{x=165,y=59,z=7})
				end
			end,10000)
		end
	end
end

 

Postado
  • Autor

@Vodkart Continua com o mesmo erro, engraçado que ele funciona certinho da primeira vez que o player joga com ele. Na segunda vez que o player volta para jogar novamente ele até gira o dado tudo mais porem n responde nada... tipo que fica mudo e aparece aquele erro na distro

Postado
local talkState = {}
local focus, old_focus = 0, 0 
local dice_pos = {x=32465,y=32497,z=7,stackpos=255}
local player_pos = {x=32464,y=32499,z=7}
local nme = "Dice"
function msgcontains(txt, str) 
	return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)')) 
end 
function onCreatureSay(cid, type, msg) 
	local msg = string.lower(msg) 
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid 

	local function rollDice(cid,ammount)
	  if not isCreature(cid) then return LUA_ERROR end
		local value = math.random(5792, 5797)
		local item = getThingFromPos(dice_pos)
		if item and item.uid and item.uid > 0 and item.itemid >= 5792 and item.itemid <= 5797 then
			doTransformItem(item.uid, value)
		end
		doSendMagicEffect(dice_pos, CONST_ME_CRAPS)
		local rolled = value - 5791
		doCreatureSay(getNpcId(), getCreatureName(getNpcId()) .. ' rolled a ' .. rolled .. '.', TALKTYPE_ORANGE_1)
		if rolled == ammount then
			local backpack = doCreateItemEx(10521)
	   		doAddContainerItem(backpack,12627,3)
	   		doAddContainerItem(backpack,12626,3)
	   		doAddContainerItem(backpack,5957,1)
	   		doAddContainerItem(backpack,10310,1)
	   		doPlayerAddItemEx(cid,backpack)
	   		doSendMagicEffect(getThingPos(cid),29)
	   		doCreatureSay(cid,gm(cid,nme,1),TALKTYPE_ORANGE_1)
	   	else
	   		doCreatureSay(cid,gm(cid,nme,2),TALKTYPE_ORANGE_1)
	   		doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
	   	end
	   	addEvent(function()
          if not isCreature(cid) then return LUA_ERROR end
	   		doPlayerSetStorageValue(cid,722522,-1)
	   		doTeleportThing(cid,{x=165,y=59,z=7})
	   	end,2000)
	end
	if isInArray({1,2,3,4,5,6},tonumber(msg)) and focus == cid then
		local storage = getPlayerStorageValue(cid,722522)
		if storage == -1 then
			doPlayerSetStorageValue(cid,722522,1)
			rollDice(cid, tonumber(msg))
		end
	end 
end
function onThink()
	local player = getTopCreature(player_pos)
	if player and player.uid and player.uid > 0 and isPlayer(player.uid) then
		if focus ~= player.uid then
			focus = player.uid
			selfSay(gm(cid,nme,3).." "..getCreatureName(player.uid)..".")?
			addEvent(function()
			if not isCreature(player.uid) then return LUA_ERROR end
				if isPlayer(player.uid) then
					doSendMagicEffect(getThingPos(player.uid),CONST_ME_POFF)
					doPlayerSetStorageValue(player.uid,722522.-1)
					doTeleportThing(player.uid,{x=165,y=59,z=7})
				end
			end,10000)
		end
	end
end

 

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo