• 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!

Shop system tfs v2 for tibia 7.6

danick10

Intermediate OT User
Joined
Apr 11, 2009
Messages
196
Solutions
4
Reaction score
141
Hello, I'currently working on a retro tibia server 7.6 with a downgraded version of tfs. I think it's the version 0.3 and i've used gesior aac. I've made many change to this acc to works fine for this version of tfs and now the shop system is perfectly working. I've used a global event script to deliver the items and I cant find out the issue. Here is the bug:


local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'LOGIN';")

cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) == TRUE then

And in the console it says : Attempt to call global 'getCreatureByName' a nil value:

Can someone explain me how to solve it please :)
 

Attachments

When ever I am checking the value I am retrieving from a function I break down the steps of the function call.

So what I would use to check the values is a simple print function which would print the results if any in the console
Example:
Code:
print( result_plr:getDataString("name") )
print( tostring( result_plr:getDataString("name") ) ) -- to string is possibly not needed but I will use it anyway
print(getCreatureName(tostring(result_plr:getDataString("name"))))
cid = getCreatureName(tostring(result_plr:getDataString("name")))
print( isPlayer(cid) )

This method of testing values allows me to see what values are being passed so I can handle them accordingly :)
 
Mmh I do not understand your method of testing, I've created a global event with your code and it says : Error global event on think
 
Mmh I do not understand your method of testing, I've created a global event with your code and it says : Error global event on think
There is no need to create a global event, a print function is part of the lua language and can be used anywhere in your scripts, maybe you should focus more on learning lua rather than editing code.

I only say this because this will help you better understand the scripts you are writing or editing.
 
Got any great ressources tout learn it or some recommended links?.. I've edited many script and learned a lot about L'UA by editing existing code, unfortunatly it doesnt help me with unkniwn fonctions .. :p
 
Back
Top