LE
script

Error em Sistema de Look Frags

Por leonardo macedo, 01 de fev. de 2016 em Scripts

8
2k
02 de fevereiro de 2016 às 00:13

Por favor alguém poderia me ajudar com esse erro no sistema de Look Frags

quando eu dou Look no meu Jogador ele apresenta esse erro na distro.

 

[1/2/2016 22:43:3] [Error - CreatureScript Interface]
[1/2/2016 22:43:3] data/creaturescripts/scripts/look.lua:onLook
[1/2/2016 22:43:3] Description:
[1/2/2016 22:43:3] (LuaInterface::luaGetPlayerNameByGUID) Player not found
Alguem pode me ajudar? - OBS: Distro OTX
Vou estar postando o script aqui em baixo.

-- Original script edited by MaxLinux or Sciter -- Look Frags --
function onLogin(cid)
registerCreatureEvent(cid, "fraglook")
return true
end
function onLook(cid, thing, position, lookDistance)
if isPlayer(thing.uid) and thing.uid ~= cid then
doPlayerSetSpecialDescription(thing.uid,' [Frags: '..getPlayerStorageValue(thing.uid, 90190)..']')
return true
elseif thing.uid == cid then
doPlayerSetSpecialDescription(cid,' [Frags: '..getPlayerStorageValue(cid, 90190)..']')
local string = 'Você vê a si mesmo.'
if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
string = string..' You are '.. getPlayerGroupName(cid) ..'.'
elseif getPlayerVocation(cid) ~= 0 then
string = string..' You are '.. getPlayerVocationName(cid) ..'.'
else
string = string..' You have no vocation.'
end
string = string..getPlayerSpecialDescription(cid)..''
if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
end
if getPlayerGuildId(cid) > 0 then
string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of '.. getPlayerGuildName(cid)
string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
string = string..'Health: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
string = string..'IP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
end
if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
string = string..'Position: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
return false
end
return true
end


@up

CaronteC
02 de fevereiro de 2016 às 00:38

Não sei o que é

getPlayerPartner

 

esse é todo o erro?

 

02 de fevereiro de 2016 às 01:36

Não sei o que é

getPlayerPartner

 

esse é todo o erro?

 

Sim é o que aparece aqui

CaronteC
02 de fevereiro de 2016 às 01:58

 

 

getPlayerPartner

é função padrão do tibia?


:o, nunca usei...

pera aí...


Tenta

if type(getPlayerPartner(cid)) == "number" then

como você não sabe o que retorna a função, tente colocar algo diferente de nil, como false...

ou tente outros meios de condições...

AdministradorA
02 de fevereiro de 2016 às 09:54

Tópico Movido
Este tópico foi movido de "OTServScriptingDownloads ScriptsActions, talkactions e moveevents"
para "OTServScriptingSuporte Scripting".

 

 

02 de fevereiro de 2016 às 22:10

é função padrão do tibia?

:o, nunca usei...

pera aí...

Tenta

if type(getPlayerPartner(cid)) == "number" then

como você não sabe o que retorna a função, tente colocar algo diferente de nil, como false...

ou tente outros meios de condições...

Desculpa, mais aonde eu substituo isso ?

@up

CaronteC
02 de fevereiro de 2016 às 22:50
   if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then

é essa parte que está gerando o erro, altere nela.

03 de fevereiro de 2016 às 20:58
   if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then

é essa parte que está gerando o erro, altere nela.

 

quando eu troco essa linha pela qual você me passou da o seguinte erro

 

[Error - CreatureScript Interface]
data/creaturescripts/scripts/look.lua:onLook
Description:
data/creaturescripts/scripts/look.lua:24: attempt to concatenate a nil value
stack traceback:
data/creaturescripts/scripts/look.lua:24: in function <data/creaturescripts/scripts/look.lua:7>