Jump to content

Search the Community

Showing results for tags 'method'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 1 result

  1. I was making a new script with classes for mta, and i need to set a timer inside a method like this. function WorldGrid:updatePlayerZone(player) -- DOING NON RELEVANT SHI T HERE outputChatBox("worldGrid: " .. tostring(worldGrid) .. " player: " .. tostring(player)) setTimer(self:updatePlayerZone, 4000, 1, player) end end This couldnt even compile, because self:updatePlayerZone is not recognized as a function. So.. i checked setTimer mta wiki page. it says: 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)) worldGrid:updatePlayerZone(player) end function WorldGrid:updatePlayerZone(player) outputChatBox("worldGrid before: " .. tostring(self) .. " player before: " .. tostring(player) setTimer(updatePlayerZoneWrapper, 4000, 1, self, player) end end But it didnt work neither.. I get: 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
×
×
  • Create New...