Hello I made a script (globalevent) and it works like I want it to, but every 2 seconds when it executes this message appears:
This is my script:
getTrainPos is a function made by me and fills the array tablepos with positions. The script works but the errors appear.
Something wrong with the script?
Code:
[Error - GlobalEvents::onThink] Couldn't execute event: trainers
This is my script:
Code:
function onThink(interval, lastExecution)
pos = {x=626, y=286, z=9}
start =
{
[1] = {x=635, y=286, z=10, stackpos=253},
[2] = {x=635, y=293, z=10, stackpos=253},
}
tablepos = {}
getTrainPos(6, start, 27, 4, 1, tablepos)
local free = #tablepos
for i = 1, #tablepos do
player = getThingFromPos({x = tablepos[i].x, y = tablepos[i].y, z = tablepos[i].z, stackpos = tablepos[i].stackpos})
if isPlayer(player.uid) or isCreature(player.uid) then
free = free - 1
end
end
doSendAnimatedText(pos,""..free.."", 70)
end
getTrainPos is a function made by me and fills the array tablepos with positions. The script works but the errors appear.
Something wrong with the script?
Last edited: