Ir para conteúdo
  • 0
SouzaBest

Scripting Comando !playerinfo - TFS 1.2

Pergunta

SouzaBest    1
SouzaBest

olá se alguem pudesse me ajuda a criar um comando na source para poder funcionar esse scripts, tfs 1.2.

 

O scripts e para ver informações do Player!

function onSay(player, words, param)

local config = {
	name = player:getName(), -- checa o nome do player
	level = player:getLevel(), -- checa o level do player
	vocation = player:getVocation():getName(), -- checa a vocação do player
	vip = player:getPremiumDays() -- checa a quantidade de dias premium
}

local armadura = 0
local earth = 0
local fire = 0
local ice = 0
local physical = 0
local holy = 0
local death = 0
local energy = 0

for i=1, 10 do
	local item = player:getSlotItem(i)
	if item.uid > 0 then
		if i == getItemInfo(item.itemid).wieldPosition then
			local att = getItemInfo(item.itemid).defense
				if att == 0 then
					att = getItemInfo(item.itemid).armor
				end
			armadura = armadura + att
			earth = earth + getItemInfo(item.itemid).absorbPercentEarth
			fire = fire + getItemInfo(item.itemid).absorbPercentFire
			ice = ice + getItemInfo(item.itemid).absorbPercentIce
			physical = physical + getItemInfo(item.itemid).absorbPercentPhysical
			holy = holy + getItemInfo(item.itemid).absorbPercentHoly
			death = death + getItemInfo(item.itemid).absorbPercentDeath
			energy = energy + getItemInfo(item.itemid).absorbPercentEnergy
		end
	end
end

player:popupFYI(cid, "Name: "..config.name.."\nLevel: "..config.level.."\nVocation: "..config.vocation.."\nArmadura: "..armadura.."\nVip: "..config.vip.." Days\nEarth: "..earth.."\nFire: "..fire.."\nIce: "..ice.."\nPhysical: "..physical.."\nHoly: "..holy.."\nDeath: "..death.."\nEnergy: "..energy)

return true
end

Compartilhar este post


Link para o post
Compartilhar em outros sites

7 respostass a esta questão

Recommended Posts

  • 0
Erondino    17
Erondino

Eu pensei que com a função em mãos você conseguiria terminar o script, se você acrescentou a função corretamente, use a script abaixo:

 

Spoiler

function onSay(cid, words, param)

local player = Player(cid)

local config = {
	name = player:getName(), -- checa o nome do player
	level = player:getLevel(), -- checa o level do player
	vocation = player:getVocation():getName(), -- checa a vocação do player
	vip = player:getPremiumDays() -- checa a quantidade de dias premium
}



local fire = 0
local ice = 0
local physical = 0
local holy = 0
local death = 0
local energy = 0


	if player:getSlotItem(CONST_SLOT_ARMOR) then
		local slotarma1 = player:getSlotItem(CONST_SLOT_ARMOR)
	if slotarma1 ~= 0 then  
	armadura1 = slotarma1:getType():getArmor()
	earth1 = slotarma1:getAbility(ITEM_ABILITY_ABSORBEARTH)
	end
	else
	armadura1 = 0
	earth = 0
	end
	
	if player:getSlotItem(CONST_SLOT_LEGS) then
		local slotarma2 = player:getSlotItem(CONST_SLOT_LEGS)
	if slotarma2 ~= 0 then  
	armadura2 = slotarma2:getType():getArmor()
	earth2 = slotarma2:getAbility(ITEM_ABILITY_ABSORBEARTH)
	end	
	else
	armadura2 = 0
	earth2 = 0
	end
	
	if player:getSlotItem(CONST_SLOT_NECKLACE) then
		local slotarma3 = player:getSlotItem(CONST_SLOT_NECKLACE)
	if slotarma3 ~= 0 then  
	armadura3 = slotarma3:getType():getArmor()
	earth3 = slotarma3:getAbility(ITEM_ABILITY_ABSORBEARTH)
	end		
	else
	armadura3 = 0
	earth3 = 0
	end
	
	if player:getSlotItem(CONST_SLOT_FEET) then
		local slotarma4 = player:getSlotItem(CONST_SLOT_FEET)
	if slotarma4 ~= 0 then  
	earth4 = slotarma4:getAbility(ITEM_ABILITY_ABSORBEARTH)
	end		
	else
	earth4 = 0
	end	
	

player:popupFYI("Name: "..config.name.."\nLevel: "..config.level.."\nVocation: "..config.vocation.."\nArmadura: "..armadura1 + armadura2 + armadura3.."\nVip: "..config.vip.." Days\nEarth: "..earth1 + earth2 + earth3 + earth4.."\nFire: "..fire.."\nIce: "..ice.."\nPhysical: "..physical.."\nHoly: "..holy.."\nDeath: "..death.."\nEnergy: "..energy)

return false
end

 

>Eu configurei apenas para aceitar Earth, falta configurar para aceitar os outros elementos, primeiro testa se esta puxando o do elemento earth sem dar erro, caso de erro poste um print, se deu certo avise.

Editado por Erondino

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Erondino    17
Erondino

Qual parte do código exatamente esta dando errado ao tentar executar o script? se possível poste um print do erro.

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
SouzaBest    1
SouzaBest

@Erondino 

Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/player/stats.lua:onSay
data/talkactions/scripts/player/stats.lua:22: attempt to call global 'getItemInfo' (a nil value)
stack traceback:
        [C]: in function 'getItemInfo'
        data/talkactions/scripts/player/stats.lua:22: in function <data/talkactions/scripts/player/stats.lua:1>

Editado por SouzaBest

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Erondino    17
Erondino

Existe várias falhas nesse seu script, criei um novo:

Spoiler

function onSay(cid, words, param)

local player = Player(cid)

local config = {
	name = player:getName(), -- checa o nome do player
	level = player:getLevel(), -- checa o level do player
	vocation = player:getVocation():getName(), -- checa a vocação do player
	vip = player:getPremiumDays() -- checa a quantidade de dias premium
}


local earth = 0
local fire = 0
local ice = 0
local physical = 0
local holy = 0
local death = 0
local energy = 0


	if player:getSlotItem(CONST_SLOT_ARMOR) then
		local slotarma1 = player:getSlotItem(CONST_SLOT_ARMOR)
	if slotarma1 ~= 0 then  
	armadura1 = slotarma1:getType():getArmor()
	end
	else
	armadura1 = 0
	end
	
	if player:getSlotItem(CONST_SLOT_LEGS) then
		local slotarma2 = player:getSlotItem(CONST_SLOT_LEGS)
	if slotarma2 ~= 0 then  
	armadura2 = slotarma2:getType():getArmor()
	end	
	else
	armadura2 = 0
	end
	
	if player:getSlotItem(CONST_SLOT_NECKLACE) then
		local slotarma3 = player:getSlotItem(CONST_SLOT_NECKLACE)
	if slotarma3 ~= 0 then  
	armadura3 = slotarma2:getType():getArmor()
	end		
	else
	armadura3 = 0
	end
	

player:popupFYI("Name: "..config.name.."\nLevel: "..config.level.."\nVocation: "..config.vocation.."\nArmadura: "..armadura1 + armadura2 + armadura3.."\nVip: "..config.vip.." Days\nEarth: "..earth.."\nFire: "..fire.."\nIce: "..ice.."\nPhysical: "..physical.."\nHoly: "..holy.."\nDeath: "..death.."\nEnergy: "..energy)

return false
end

 

>A parte de elementos não esta configurado, pois você precisa de uma função chamado: item:getAbility(key)

>Para adicionar essa função na sua source segue o tutorial:

https://otland.net/threads/tfs-1-3-item-abilities-via-lua.260156/

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
SouzaBest    1
SouzaBest

Mesmo equipando o items com tal elemento fica sempre 0 no scripts :(

Sem_título.png

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Erondino    17
Erondino

Você colocou o que foi pedido na source? 

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
SouzaBest    1
SouzaBest

sim fiz tudo oq pediu 

Editado por SouzaBest

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×