I was making a new script with classes for mta, and i need to set a timer inside a method like this.
-- DOING NON RELEVANT SHI T HERE
outputChatBox("worldGrid: " .. tostring(worldGrid) .. " player: " .. tostring(player))
setTimer(self:updatePlayerZone, 4000, 1, player)
This couldnt even compile, because self:updatePlayerZone is not recognized as a function.
So.. i checked setTimer mta wiki page.
theFunction: The function you wish the timer to call. (Notice: Do not use a 'local' function, it must be global!)
So, i need to call a global function on setTimer.
I tryed out this:
function updatePlayerZoneWrapper(worldGrid, player)
outputChatBox("worldGrid " .. tostring(worldGrid) .. " player: " .. tostring(player))
outputChatBox("worldGrid before: " .. tostring(self) .. " player before: " .. tostring(player)
setTimer(updatePlayerZoneWrapper, 4000, 1, self, player)
But it didnt work neither..
Attempt to call method 'updatePlayerZone' (a nil value)
I continued reading setTimer wiki page, and i found this:
arguments: Any arguments you wish to pass to the function can be listed after the timesToExecute argument. Note that any tables you want to pass will get cloned, whereas metatables and functions/function references in that passed table will get lost. Also changes you make in the original table before the function gets called won't get transferred.
So, im coming to you guys, hoping you have a possible solution for this.
Thanks for your time