• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

ERROR IN LOOK (OTC) PLEASE HELP

Swiftxd

Member
Joined
Apr 5, 2014
Messages
85
Reaction score
5
this is a simple test script

function onLook(cid, thing, position, lookDistance)
if isPlayer(cid) then
doPlayerAddItem(cid, 2160, 5)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Here is some cash.")
end
end

In tibia simple client, it work perfectly: appear a msg in Default chat and i won the money

In OTClient, nothing happens, why ? have something with extended opcodes?


Im using OTX server(The OTX Server Version: (2.90 - 4539)), version 10.31 tibia ...
 
Last edited:
@Edit

function onLook(cid, thing, position, lookDistance)
if isPlayer(cid) then
doPlayerAddItem(cid, 2160, 5)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Here is some cash.")
end
return true
end
When i look to objects, its work perfectly, but when i look to players, doesnt work ( in OTC)
 
i tried rewrite with function Player: OnLook(thing, position, distance), but didnt work ,can u writh the code to check ? please

attempt to index global 'Player' (a nil value)
always say it
 
Last edited:
the reason why it doesn't work for otclient is because when you look on a creature on otclient it calls onLookInBattleList instead of the normal "onlook" function
Code:
function Player:onLookInBattleList(creature, distance)
so just add this under that function in events/scripts/player.lua
Code:
if creature:isPlayer() then
doPlayerAddItem(self, 2160, 5)
doPlayerSendTextMessage(self, MESSAGE_STATUS_CONSOLE_BLUE, "Here is some cash.")
end

and it should work for otclient :)
 
Last edited:
Back
Top