Jump to content

maramizo

Members
  • Posts

    5
  • Joined

  • Last visited

maramizo's Achievements

Vic

Vic (3/54)

1

Reputation

  1. https://wiki.multitheftauto.com/wiki/Call Call a function that returns the player's playtime from the script as mentioned above from whichever resource you're using it on. If statement to check on the increment and givePlayerMoney(playerid, 10000).
  2. tl;dr is that you get a timer that increments variables that logically link to the player's playing minutes. Once they have enough minutes, you call whichever function you want to call. You're going to need a variable under events/commands to check if the player's actions have changed during the time between the timers to make sure they're not AFK, unless if you don't mind them being AFK, or check on their X/Y/Z co-ords for changes (can be anim abused). A combination of both works in order to ensure that the person really isn't AFK, and if only the co-ords check is satisfied then you could probably do some sort of admin warning (could add getPedAnimation and another variable just to check if they've been on the same animation for a while).
  3. Fixed this, silly mistake leaving the localPlayer arg there. Only the second question remains, I need to destroy all objects in a class to free up memory, given they're useless after a specific point in the code. How do I iterate through the metadata's index in the class defined as follows: Casing = {} Casing.__index = Casing sentArray = {} function Casing.create(x, y, z) if x ~= nil and y ~= nil and z ~= nil then local _casing = {} setmetatable(_casing,Casing) --etc. return _casing end end
  4. Alright, two quick questions; 1. How do you send an array from a client to the server using triggerServerEvent? This yields an error: triggerServerEvent("ejectCase", resourceRoot, localPlayer, unpack(sentArray)) function gCreateEjectedCase(lArray) --code end addEvent("ejectCase", true) addEventHandler("ejectCase", resourceRoot, gCreateEjectedCase) Error is as follows: ERROR: ejectCasings\ejectrS.lua:4: bad argument #1 to 'ipairs' (table expected, got userdata) 2. How do you destroy all objects within a class? Thanks.
  5. Function aims to get side of matrix co-ordinations (in this case player co-ords). Should return a modified X,Y,Z to get the side of the player, instead returns nil. function getSideOfPlayer() local x,y,z = getElementPosition(localPlayer) local z = getGroundPosition(x,y,z) local rX, rY, rZ = getElementRotation(localPlayer) local eMatrix = (Matrix.create(x,y,z,rX,rY,rZ)) return (Matrix.getPosition(eMatrix) + Matrix.getRight(eMatrix)*math.random(3)) -- Random slight reposition to the right side of the player. end Function is called by another function and stored in only three variables as follows: local x,y,z = getSideOfPlayer() Why is it returning nil instead of actual co-ordinates? Thanks.
×
×
  • Create New...