Deep thinker Posted November 9, 2016 Share Posted November 9, 2016 hello i want to know what kind of functions in a script which depends on the play time . should i use "export" from the play time script ? the point of my code is to give the player when gains 1 more hour in his play time . thank you 2 minutes ago, ProMax said: the point of my code is to give the player when gains 1 more hour in his play time . sorry about that part i meant to give the player money when he gains 1 more hour in his play time. thank you Link to comment
maramizo Posted November 9, 2016 Share Posted November 9, 2016 (edited) 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). Edited November 9, 2016 by maramizo Link to comment
Deep thinker Posted November 9, 2016 Author Share Posted November 9, 2016 actually you didn't get the point i just want to export the player's play time from a script called for ex :"playtime" and if it's increased 1 more hour give him 10000$ to notice the part of the players AFK i got an ANTI AFK system that if the player didn't move for 5 minutes he will be auto kicked from the server. Link to comment
maramizo Posted November 9, 2016 Share Posted November 9, 2016 Just now, ProMax said: actually you didn't get the point i just want to export the player's play time from a script called for ex :"playtime" and if it's increased 1 more hour give him 10000$ to notice the part of the players AFK i got an ANTI AFK system that if the player didn't move for 5 minutes he will be auto kicked from the server. 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). 1 Link to comment
Deep thinker Posted November 9, 2016 Author Share Posted November 9, 2016 6 minutes ago, maramizo said: 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). i am going to script it so give me time Link to comment
Gravestone Posted November 10, 2016 Share Posted November 10, 2016 Use onElementDataChange and check if the play time data was changed. For example: function checkPlayTime(dataName, oldValue) if getElementType(source) == "player" then if dataName == "playingHours" then -- check if the "playingHours" data changed you can change the data name tho if oldValue < getElementData(source, "playingHours") -- if the old value is less than new one givePlayerMoney(source, money) end end end end addEventHandler("onElementDataChange", root, checkPlayTime) 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now