Ir para conteúdo

Featured Replies

Postado

Boa noite tibianos, como eu tenho 0% de conhecimentos em arquilo.lua, estou pedindo uma pequena ajuda. No meu cassino você usa price (moeda) para jogar, gostaria que usasse o itemid: 9971 para jogar.

exemplo: você roda a alavanca e gasta o id:9971

se ganhar você ganha 10 9971

Meu arquivo. tfs 0.4 

Citar

local bixos = {"Jack Sparrow", "Catatau", "Belmont's Revenge"}
local positions = {{x = 386, y = 154, z = 7}, {x = 388, y = 154, z = 7}, {x = 390, y = 154, z = 7}} -- Posicao q os bixos nascem
local price = 1 -- Preco para jogar
local cassinoCoin = 6527

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local first = math.random(1, #bixos)
    local second = math.random(1, #bixos)
    local third = math.random(1, #bixos)
    local tab = {}
    local recheck = 0
        
    if getGlobalStorageValue(82192) > os.time() then
        doPlayerSendCancel(cid, "Aguarde um pouco para apostar.")
        return true
    end
    
    if getPlayerMoney(cid) < price * 1000000 then
        doPlayerSendCancel(cid, "Você precisa de " .. price .. " kk para jogar.")
        return true
    end
    
    setGlobalStorageValue(82192, os.time() + 6)
    for i = 1, (#positions) do
        doSendMagicEffect(positions, 37)
    end
    
    doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    doPlayerRemoveMoney(cid, price*1000000)
    doCreateMonster(bixos[first], positions[1])
    doSendMagicEffect(positions[1], 26)
    addEvent(doSendMagicEffect, 100, positions[1], 37)
    table.insert(tab, first)
    setGlobalStorageValue(bixos[first], getGlobalStorageValue(bixos[first])+1) 
    addEvent(function()
        doCreateMonster(bixos[second], positions[2])
        doSendMagicEffect(positions[2], 26)
        addEvent(doSendMagicEffect, 100, positions[2], 37)
        table.insert(tab, second)
    end, 1700)
    addEvent(function()
        doCreateMonster(bixos[third], positions[3])
        doSendMagicEffect(positions[3], 26)
        addEvent(doSendMagicEffect, 100, positions[3], 37)
        setGlobalStorageValue(bixos[third], getGlobalStorageValue(bixos[third])+1)
        table.insert(tab, third)
    end, 2000)
    addEvent(function()
        doRemoveCreature(getTopCreature(positions[1]).uid)
        doRemoveCreature(getTopCreature(positions[2]).uid)
        doRemoveCreature(getTopCreature(positions[3]).uid)
            doSendMagicEffect(positions[1], 61)
            doSendMagicEffect(positions[2], 61)
            doSendMagicEffect(positions[3], 61)
        if tab[1] == tab[2] and tab[1] == tab[3] then
            doPlayerAddItem(cid, 6527, 15)
            doSendAnimatedText(getThingPos(cid), "VOCE", 25)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "GANHOU", 25)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "30", 25)
        addEvent(doSendAnimatedText, 3000, getThingPos(cid), "EVENTCOINS", 25)
            doSendMagicEffect(getThingPos(cid), 30)
            doSendMagicEffect(positions[1], 30)
            doSendMagicEffect(positions[2], 30)
            doSendMagicEffect(positions[3], 30)
            addEvent(doSendMagicEffect, 800, getThingPos(cid), 29)
            addEvent(doSendMagicEffect, 800, positions[1], 29)
            addEvent(doSendMagicEffect, 800, positions[2], 29)
            addEvent(doSendMagicEffect, 800, positions[3], 29)
            addEvent(doSendMagicEffect, 1600, getThingPos(cid), 28)
            addEvent(doSendMagicEffect, 1600, positions[1], 28)
            addEvent(doSendMagicEffect, 1600, positions[2], 28)
            addEvent(doSendMagicEffect, 1600, positions[3], 28)
        else
            doSendAnimatedText(getThingPos(cid), "VOCE", 200)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "PERDEU", 200)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "HAHA", 200)
        end
    end, 4200)
    return true
end
 

 

Resolvido por FlavioHulk

Ir para solução
  • Respostas 10
  • Visualizações 739
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local config, tab = { creatures = { [1] = "Jack Sparrow", [2] = "Catatau", [3] = "Belmont's Revenge" }, positions = { [1] = {x = 386, y = 154, z = 7}, [2] = {x = 388, y = 154, z = 7}, [

  • local config, tab = { creatures = { [1] = "Jack Sparrow", [2] = "Catatau", [3] = "Belmont's Revenge" }, positions = { [1] = {x = 386, y = 154, z = 7}, [2] = {x = 388, y = 154, z = 7}, [

  • local config, tab = { creatures = { [1] = "Jack Sparrow", [2] = "Catatau", [3] = "Belmont's Revenge" }, positions = { [1] = {x = 386, y = 154, z = 7}, [2] = {x = 388, y = 154, z = 7}, [

Postado
local config, tab = {
	creatures = {
		[1] = "Jack Sparrow",
		[2] = "Catatau",
		[3] = "Belmont's Revenge"
	},
	positions = {
		[1] = {x = 386, y = 154, z = 7},
		[2] = {x = 388, y = 154, z = 7},
		[3] = {x = 390, y = 154, z = 7}
	},
	price = 1,
	amountReward = 10,
	cassinoCoin = 6527,
}, {}

local function createMonster(creature, position)
	doCreateMonster(creature, position)
	doSendMagicEffect(position, 26)
	addEvent(doSendMagicEffect, 100, position, 37)
	return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getGlobalStorageValue(82192) > os.time() then
        doPlayerSendCancel(cid, "Aguarde um pouco para apostar.")
        return true
    end
    
    if getPlayerItemCount(cid, config.cassinoCoin) < 1 then
        doPlayerSendCancel(cid, "Você precisa de " .. price .. " " .. getItemNameById(config.cassinoCoin) .." para jogar.")
        return true
    end
    
    setGlobalStorageValue(82192, os.time() + 6)
    for i = 1, (#config.positions) do
        doSendMagicEffect(positions[i], 37)
    end
    
    doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    doPlayerRemoveItem(cid, config.cassinoCoin, config.price)
    for i = 1, #config.positions do
    	local pos, creature = config.positions[i], math.random(1, #config.creatures)
    	createMonster(creature, pos)
    	tab[#tab + 1] = creature
    	if i ~= 1 then
    		addEvent(createMonster, i = 2 and 1700 or 2000, creature, pos)
    	end
    end

    addEvent(function()
    	for i = 1, #config.positions do
    		local pos = config.positions[i]
        	doRemoveCreature(getTopCreature(pos).uid)
        	doSendMagicEffect(pos, 61)
        end
        if tab[1] == tab[2] and tab[1] == tab[3] then
            doPlayerAddItem(cid, config.cassinoCoin, config.amountReward)

			doSendAnimatedText(getThingPos(cid), "VOCE", 25)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "GANHOU", 25)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "30", 25)
        	addEvent(doSendAnimatedText, 3000, getThingPos(cid), "EVENTCOINS", 25)

	    	for i = 1, #config.positions do
	    		local pos = config.positions[i]
	        	doSendMagicEffect(pos, 30)
	        end

	        for i = 1, #config.positions do
	        	local pos = config.positions[i]
	        	addEvent(doSendMagicEffect, 800, pos, 29)
	        end
	        for i = 1, #config.positions do
	        	local pos = config.positions[i]
	        	addEvent(doSendMagicEffect, 1600, pos, 28)
	        end

			doSendMagicEffect(getThingPos(cid), 30)
            addEvent(doSendMagicEffect, 800, getThingPos(cid), 29)
            addEvent(doSendMagicEffect, 1600, getThingPos(cid), 28)
        else
            doSendAnimatedText(getThingPos(cid), "VOCE", 200)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "PERDEU", 200)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "HAHA", 200)
        end
    end, 4200)
    return true
end

 

Tentei dar uma enxugada no script, qualquer erro, só comentar que corrijo haha

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

Postado
  • Autor
36 minutos atrás, FlavioHulk disse:

local config, tab = {
	creatures = {
		[1] = "Jack Sparrow",
		[2] = "Catatau",
		[3] = "Belmont's Revenge"
	},
	positions = {
		[1] = {x = 386, y = 154, z = 7},
		[2] = {x = 388, y = 154, z = 7},
		[3] = {x = 390, y = 154, z = 7}
	},
	price = 1,
	amountReward = 10,
	cassinoCoin = 6527,
}, {}

local function createMonster(creature, position)
	doCreateMonster(creature, position)
	doSendMagicEffect(position, 26)
	addEvent(doSendMagicEffect, 100, position, 37)
	return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getGlobalStorageValue(82192) > os.time() then
        doPlayerSendCancel(cid, "Aguarde um pouco para apostar.")
        return true
    end
    
    if getPlayerItemCount(cid, config.cassinoCoin) < 1 then
        doPlayerSendCancel(cid, "Você precisa de " .. price .. " " .. getItemNameById(config.cassinoCoin) .." para jogar.")
        return true
    end
    
    setGlobalStorageValue(82192, os.time() + 6)
    for i = 1, (#config.positions) do
        doSendMagicEffect(positions[i], 37)
    end
    
    doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    doPlayerRemoveItem(cid, config.cassinoCoin, config.price)
    for i = 1, #config.positions do
    	local pos, creature = config.positions[i], math.random(1, #config.creatures)
    	createMonster(creature, pos)
    	tab[#tab + 1] = creature
    	if i ~= 1 then
    		addEvent(createMonster, i = 2 and 1700 or 2000, creature, pos)
    	end
    end

    addEvent(function()
    	for i = 1, #config.positions do
    		local pos = config.positions[i]
        	doRemoveCreature(getTopCreature(pos).uid)
        	doSendMagicEffect(pos, 61)
        end
        if tab[1] == tab[2] and tab[1] == tab[3] then
            doPlayerAddItem(cid, config.cassinoCoin, config.amountReward)

			doSendAnimatedText(getThingPos(cid), "VOCE", 25)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "GANHOU", 25)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "30", 25)
        	addEvent(doSendAnimatedText, 3000, getThingPos(cid), "EVENTCOINS", 25)

	    	for i = 1, #config.positions do
	    		local pos = config.positions[i]
	        	doSendMagicEffect(pos, 30)
	        end

	        for i = 1, #config.positions do
	        	local pos = config.positions[i]
	        	addEvent(doSendMagicEffect, 800, pos, 29)
	        end
	        for i = 1, #config.positions do
	        	local pos = config.positions[i]
	        	addEvent(doSendMagicEffect, 1600, pos, 28)
	        end

			doSendMagicEffect(getThingPos(cid), 30)
            addEvent(doSendMagicEffect, 800, getThingPos(cid), 29)
            addEvent(doSendMagicEffect, 1600, getThingPos(cid), 28)
        else
            doSendAnimatedText(getThingPos(cid), "VOCE", 200)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "PERDEU", 200)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "HAHA", 200)
        end
    end, 4200)
    return true
end

 

Tentei dar uma enxugada no script, qualquer erro, só comentar que corrijo haha

 

 

Boa noite meu bom, deu este erro :( 

[Error - LuaInterface::loadFile] data/actions/scripts/Cassino.lua:47: ')' expected near '='
[Error - Event::checkScript] Cannot load script (data/actions/scripts/Cassino.lua)
data/actions/scripts/Cassino.lua:47: ')' expected near '='
(done).

muito obrigado por tentar me ajudar 

Postado
local config, tab = {
	creatures = {
		[1] = "Jack Sparrow",
		[2] = "Catatau",
		[3] = "Belmont's Revenge"
	},
	positions = {
		[1] = {x = 386, y = 154, z = 7},
		[2] = {x = 388, y = 154, z = 7},
		[3] = {x = 390, y = 154, z = 7}
	},
	price = 1,
	amountReward = 10,
	cassinoCoin = 6527,
}, {}

local function createMonster(creature, position)
	doCreateMonster(creature, position)
	doSendMagicEffect(position, 26)
	addEvent(doSendMagicEffect, 100, position, 37)
	return true
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getGlobalStorageValue(82192) > os.time() then
        doPlayerSendCancel(cid, "Aguarde um pouco para apostar.")
        return true
    end
    
    if getPlayerItemCount(cid, config.cassinoCoin) < 1 then
        doPlayerSendCancel(cid, "Você precisa de " .. price .. " " .. getItemNameById(config.cassinoCoin) .." para jogar.")
        return true
    end
    
    setGlobalStorageValue(82192, os.time() + 6)
    for i = 1, (#config.positions) do
        doSendMagicEffect(positions[i], 37)
    end
    
    doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    doPlayerRemoveItem(cid, config.cassinoCoin, config.price)
    for i = 1, #config.positions do
    	local pos, creature = config.positions[i], math.random(1, #config.creatures)
    	createMonster(creature, pos)
    	tab[#tab + 1] = creature
    	if i ~= 1 then
	    	if i == 2 then
	    		addEvent(createMonster, 1700, creature, pos)
	    	else
	    		addEvent(createMonster, 2000, creature, pos)
	    	end
	    end
    end

    addEvent(function()
    	for i = 1, #config.positions do
    		local pos = config.positions[i]
        	doRemoveCreature(getTopCreature(pos).uid)
        	doSendMagicEffect(pos, 61)
        end
        if tab[1] == tab[2] and tab[1] == tab[3] then
            doPlayerAddItem(cid, config.cassinoCoin, config.amountReward)

			doSendAnimatedText(getThingPos(cid), "VOCE", 25)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "GANHOU", 25)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "30", 25)
        	addEvent(doSendAnimatedText, 3000, getThingPos(cid), "EVENTCOINS", 25)

	    	for i = 1, #config.positions do
	    		local pos = config.positions[i]
	        	doSendMagicEffect(pos, 30)
	        end

	        for i = 1, #config.positions do
	        	local pos = config.positions[i]
	        	addEvent(doSendMagicEffect, 800, pos, 29)
	        end
	        for i = 1, #config.positions do
	        	local pos = config.positions[i]
	        	addEvent(doSendMagicEffect, 1600, pos, 28)
	        end

			doSendMagicEffect(getThingPos(cid), 30)
            addEvent(doSendMagicEffect, 800, getThingPos(cid), 29)
            addEvent(doSendMagicEffect, 1600, getThingPos(cid), 28)
        else
            doSendAnimatedText(getThingPos(cid), "VOCE", 200)
            addEvent(doSendAnimatedText, 800, getThingPos(cid), "PERDEU", 200)
            addEvent(doSendAnimatedText, 1600, getThingPos(cid), "HAHA", 200)
        end
    end, 4200)
    return true
end

 

Postado
  • Autor

@FlavioHulk aquele erro desapareceu, mas ainda nao surge efeito nenhum e dá esse novo erro toda vez que eu uso a alavanca


 

Citar

[Error - Action Interface]
data/actions/scripts/Killua Cassino.lua:onUse
Description:
data/actions/scripts/Killua Cassino.lua:37: attempt to index global 'positions' (a nil value)
stack traceback:
data/actions/scripts/Killua Cassino.lua:37: in function


novamente muito obrigado, você está me ajudando muito

 

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.6k

Informação Importante

Confirmação de Termo