Ir para conteúdo
  • 0

[PEDIDO] Arrumar uma action minha


jvcasarin

Pergunta

Bom gente, criei um outro tópico, pedindo ajuda em um movement, em que se o player tiver a storage 18597, ele passa pelo tile, se não tiver a storage, ele não passa, ai vai o script do movement:

function onStepIn(cid, item, position, fromPosition)
local storage = 18597
 
if getPlayerStorageValue(cid, storage) <= 0 then
doPlayerSendCancel(cid, "You're not a VIP player.")
doTeleportThing(cid, fromPosition)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return true
else
doPlayerSendTextMessage(cid, "Welcome to the VIP Area!")
doSendMagicEffect(getThingPos(cid), 14)
end
return true
end

Criei uma action para quando o player usar X item, adiciona a storage à ele, está funcionando normalmente, porém quando o player tem a storage, e vai no tile, aparece um erro no distro:

 

[4:4:26.603] [Error - MoveEvents Interface]

[4:4:26.603] data/movements/scripts/betile.lua:onStepIn
[4:4:26.603] Description:
[4:4:26.603] (luaDoPlayerSendTextMessage) Player not found
De resto no script, está funcionando.
Ai vai o script da action:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 18597
 
if getPlayerStorageValue(cid, storage) <= 0 then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+18597)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
return true
else
doSendPlayerCancel(cid, "Voce ja e um Modd Player.")
end
end
return true
end
Se depois de arrumarem o script, puderem melhorar ele e POR FAVOR, ME EXPLICAR O QUE FOI MODIFICADO E POR QUE!
Grato desde ja!
Editado por jvcasarin
Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

Não acredito que só percebi agora onde é o erro kkkkkkkk, mas esse script não funciona.

 

 

Mesmo eu não possuindo essa storage, eu posso pisar no tile, e usando o item, posso também.

 

Não aparece mais o erro no distro, porém não aparece nenhuma mensagem para o player.

Tenta assim, com outra storage e algumas modificações:

 

Action:

local storage = 13513
local days = 30 -- dias que serão adicionados

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local timenow = os.time()
	local daysvalue = days * 24 * 60 * 60
	local timeToAdd = 0

	if getPlayerStorageValue(cid, storage) - os.time() <= 0 then
		timeToAdd = daysvalue + os.time()
	else
		timeToAdd = daysvalue + getPlayerStorageValue(cid, storage)
	end

	doRemoveItem(item.uid, 1)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	setPlayerStorageValue(cid, storage, timeToAdd)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
	return true
end

Movements:

local storage = 13513

function onStepIn(cid, item, position, fromPosition)
	if not isPlayer(cid) then return false end
	if getPlayerStorageValue(cid, storage) - os.time() <= 0 then
		doCreatureSay(cid, "You're not a VIP player.", TALKTYPE_ORANGE_1)
		doTeleportThing(cid, fromPosition)
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		return false
	end

	doCreatureSay(cid, "Welcome to the VIP Area!", TALKTYPE_ORANGE_1)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	return true
end
Link para o comentário
Compartilhar em outros sites

  • 0
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 18597
 
if getPlayerStorageValue(cid, 18597) <= 0 then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, 18597, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
return true
else
doSendPlayerCancel(cid, "Voce ja e um Modd Player.")
return true
end
end
end

Tente assim, caso funcione, foi editado apenas em:

if getPlayerStorageValue(cid, storage) <= 0 then
Por
if getPlayerStorageValue(cid, 18597) <= 0 then

E
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+18597)
Por
setPlayerStorageValue(cid, 18597, 1)
Editado por AdminGabriel
Link para o comentário
Compartilhar em outros sites

  • 0

Já ao iniciar o server, aparece esse erro no distro:

 

 

[4:21:10.643] [Error - LuaInterface::loadFile] data/actions/scripts/betile.lua:15: '<eof>' expected near 'end'

[4:21:10.645] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/betile.lua)
[4:21:10.648] data/actions/scripts/betile.lua:15: '<eof>' expected near 'end'

 

Link para o comentário
Compartilhar em outros sites

  • 0

moveevents

function onStepIn(cid, item, position, fromPosition)

local config = {
msgDenied = "Você não e vip.",
msgWelcome = "Seja Bem Vindo a Area vip.",
}

local s = 18597


if getPlayerStorageValue(cid, s) - os.time() <= 0 then 
doTeleportThing(cid, fromposition, true)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return true
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgWelcome)
return true
end

actions

function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 18597
 
if getPlayerStorageValue(cid, storage) <= 0 then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+18597)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
return true
else
doSendPlayerCancel(cid, "Voce ja e um Modd Player.")
end
end
Link para o comentário
Compartilhar em outros sites

  • 0

Apenas postando minha versão dos códigos, caso as acima não funcionem.

Movevent:

local storage = 18597
 
function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then return true end
    if getPlayerStorageValue(cid, storage) <= 0 then
        doPlayerSendCancel(cid, "You're not a VIP player.")
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    else
        doPlayerSendTextMessage(cid, 27, "Welcome to the VIP Area!")        --Faltava o parâmetro responsável pela cor da mensagem.
        doSendMagicEffect(getThingPos(cid), 14)
    end
    return true
end
Action:
local storage = 18597
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, storage) <= 0 then
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
        setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 18597)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
    else
        doSendPlayerCancel(cid, "Voce ja e um Modd Player.")
    end
    --Você colocou um end a mais aqui.
    return true
end

 

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

  • 0

Editado lá em cima.

 

Não funcionou... O mesmo erro a cima..

 

 

 

moveevents

function onStepIn(cid, item, position, fromPosition)

local config = {
msgDenied = "Você não e vip.",
msgWelcome = "Seja Bem Vindo a Area vip.",
}

local s = 18597


if getPlayerStorageValue(cid, s) - os.time() <= 0 then 
doTeleportThing(cid, fromposition, true)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return true
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgWelcome)
return true
end

actions

function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 18597
 
if getPlayerStorageValue(cid, storage) <= 0 then
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+18597)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
return true
else
doSendPlayerCancel(cid, "Voce ja e um Modd Player.")
end
end

 

Não funcionou, está a mesma coisa q o meu código, aparece esse erro ao pisar no tile tendo a storage:

 

[12:39:06.486] [Error - MoveEvents Interface]

[12:39:06.486] data/movements/scripts/betile.lua:onStepIn
[12:39:06.487] Description:
[12:39:06.487] (luaDoPlayerSendTextMessage) Player not found

 

 

 

 

 

Apenas postando minha versão dos códigos, caso as acima não funcionem.

Movevent:

local storage = 18597
 
function onStepIn(cid, item, position, fromPosition)
    if getPlayerStorageValue(cid, storage) <= 0 then
        doPlayerSendCancel(cid, "You're not a VIP player.")
        doTeleportThing(cid, fromPosition)
        doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
    else
        doPlayerSendTextMessage(cid, 27, "Welcome to the VIP Area!")        --Faltava o parâmetro responsável pela cor da mensagem.
        doSendMagicEffect(getThingPos(cid), 14)
    end
    return true
end
Action:
local storage = 18597
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerStorageValue(cid, storage) <= 0 then
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
        setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + 18597)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
    else
        doSendPlayerCancel(cid, "Voce ja e um Modd Player.")
    end
    --Você colocou um end a mais aqui.
    return true
end

 

 

 

A mesma coisa para o Kissy kkkk.

 

[12:39:06.486] [Error - MoveEvents Interface]

[12:39:06.486] data/movements/scripts/betile.lua:onStepIn
[12:39:06.487] Description:
[12:39:06.487] (luaDoPlayerSendTextMessage) Player not found

 

 

 

 

 

 

 

 

Explicar melhor:

 

Ao usar o item, eu recebo a storage e tal, e consigo ir no tile q tem X actionid. Quando o player q tem a storage for no tile, ele vai de boa, mas no console aparece esse erro ai a CADA vez que o player pisa no tile.

 

 

 

 

@TODOS - não precisa mais do script de movement n uheuheuhee mas vlw

Link para o comentário
Compartilhar em outros sites

  • 0

qual sua tag do moveevents.xml ? O action que postei funcionou?

<movement type="StepIn" event="script" value="betile.lua"/>

 

E não, ficou igual o meu script, aparece erro ao pisar.

 

 

w/e, mesmo você não precisando mais, já editei o código com a correção.

 

Como assim? Está falando do movement ou action?

Link para o comentário
Compartilhar em outros sites

  • 0

Esqueci, na tag eu tinha colocado ActionID="13131"

 

 

Alguém me explica o que acontece nesse script?

 

function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 18597
local days = 30 -- dias que serão adicionados
local timenow = os.time()
local daysvalue = days * 24 * 60 * 60
 
if getPlayerStorageValue(cid, storage) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storage + daysvalue
end
 
doRemoveItem(item.uid, 1)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+18597)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
local quantity = math.floor((getPlayerStorageValue(cid, storage) - timenow)/(24 * 60 * 60))
return true
else
doSendPlayerCancel(cid, "Voce ja e um Modd Player.")
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
end
return true
end
Editado por jvcasarin
Link para o comentário
Compartilhar em outros sites

  • 0

@@jvcasarin,

 

Tenta assim, movement:

local storage = 18597

function onStepIn(cid, item, position, fromPosition)
	if not isPlayer(cid) then return false end
	if getPlayerStorageValue(cid, storage) - os.time() <= 0
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You're not a VIP player.") 
		doTeleportThing(cid, fromPosition)
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		return false
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome to the VIP Area!")
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	return true
end
Action:

local storage = 18597
local days = 30 -- dias que serão adicionados

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local timenow = os.time()
	local daysvalue = days * 24 * 60 * 60
	local timeToAdd = 0

	if getPlayerStorageValue(cid, storage) - os.time() <= 0 then
		timeToAdd = timenow + daysvalue
	else
		timeToAdd = storage + daysvalue
	end

	doRemoveItem(item.uid, 1)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + timeToAdd)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
	return true
end
Link para o comentário
Compartilhar em outros sites

  • 0

 

adiciona a vip.

Usou a tag do jeito que enviei?

 

Sim usei. Ficou a mesma coisa.

 

 

@@jvcasarin,

 

Tenta assim, movement:

local storage = 18597

function onStepIn(cid, item, position, fromPosition)
	if not isPlayer(cid) then return false end
	if getPlayerStorageValue(cid, storage) - os.time() <= 0
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You're not a VIP player.") 
		doTeleportThing(cid, fromPosition)
		doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
		return false
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome to the VIP Area!")
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	return true
end
Action:

local storage = 18597
local days = 30 -- dias que serão adicionados

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local timenow = os.time()
	local daysvalue = days * 24 * 60 * 60
	local timeToAdd = 0

	if getPlayerStorageValue(cid, storage) - os.time() <= 0 then
		timeToAdd = timenow + daysvalue
	else
		timeToAdd = storage + daysvalue
	end

	doRemoveItem(item.uid, 1)
	doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
	setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage) + timeToAdd)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabens, voce se tornou um Modd Player")
	return true
end

 

 

 

Vlw a tentativa, mas continua a mesma coisa... Se o player tem a storage, e pisa no tile, tudo bem, mas aparece esse erro no distro:

 

 

[16:51:56.937] [Error - MoveEvents Interface]

[16:51:56.938] data/movements/scripts/betile.lua:onStepIn
[16:51:56.938] Description:
[16:51:56.938] (luaDoPlayerSendTextMessage) Player not found

 

 

 

Tem como você me explicar como funciona o seu script ai?

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...