raynner Posted October 22, 2016 Share Posted October 22, 2016 someone could provide me a function that checks how long a player is online'm working on a level of resource system and wanted to give xp to be a Serta contia time online n could not think of a way to do this using SetTimer. help me Link to comment
koragg Posted October 22, 2016 Share Posted October 22, 2016 I think this will do the trick for you. https://community.multitheftauto.com/index.php?p=resources&s=details&id=9573 It saves the playtime to each player's account. Link to comment
Simple0x47 Posted October 22, 2016 Share Posted October 22, 2016 You could add a tick count on the clientside on Render and then pass the info to the server by an event. Link to comment
raynner Posted October 22, 2016 Author Share Posted October 22, 2016 12 hours ago, koragg said: I think this will do the trick for you. https://community.multitheftauto.com/index.php?p=resources&s=details&id=9573 It saves the playtime to each player's account. Good is not how I wanted 11 hours ago, Simple01 said: You could add a tick count on the clientside on Render and then pass the info to the server by an event. Ok I will see how it will be this way Link to comment
DNL291 Posted October 23, 2016 Share Posted October 23, 2016 Check out this thread. Maybe it will have what you are looking for. Link to comment
raynner Posted October 23, 2016 Author Share Posted October 23, 2016 (edited) I've done what I wanted in a simple way, I now have another problem I can not use setElementData to ProgressBar This is the proto tico works the way I want timer in SetTimer for testing. --- XpBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false) LevelBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false) --- addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), function () guiSetAlpha(XpBar,0) guiSetAlpha(LevelBar,0) XP = guiProgressBarGetProgress(XpBar) LVL = guiProgressBarGetProgress(LevelBar) setTimer (DropXpPerTimer, 1000, 0, getLocalPlayer()) end) --- this is what I wanted to do originally because I want givar xp by doing some things on the server and check the level for him to carry out certain work. --- XpBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false) LevelBar = guiCreateProgressBar(x*772, y*696, x*99, y*17, false) --- addEventHandler ("onClientResourceStart",getResourceRootElement(getThisResource()), function () guiSetAlpha(XpBar,0) guiSetAlpha(LevelBar,0) XP = guiProgressBarGetProgress(XpBar) LVL = guiProgressBarGetProgress(LevelBar) setElementData(XP,"XPThePlayer",true) setElementData(LVL,"LVLThePlayer",true) setTimer (DropXpPerTimer, 1000, 0, getLocalPlayer()) end) --- I wanted to use the getElementData from then. --- function DropXpPerTimer(player) if (player == getLocalPlayer()) then guiProgressBarSetProgress(XpBar,guiProgressBarGetProgress(XpBar)+1) if guiProgressBarGetProgress(XpBar) ~= 100 then outputChatBox("#FFAA00||#FFFF00 ❗ #FFAA00||#00FF7B +1 #00FF00De #00FF7BXP #00FF00...",255,255,255,true) end if (guiProgressBarGetProgress(XpBar) == 100) then guiProgressBarSetProgress(XpBar, 0) guiProgressBarSetProgress(LevelBar,guiProgressBarGetProgress(XpBar)+1) outputChatBox("#FFAA00||#FFFF00 ❗ #FFAA00||#00FF00 ......"..guiProgressBarGetProgress(LevelBar).."#00FF00.",255,255,255,true) end end end --- But he always sends me a debug error saying that I used a bad argument and value = 0 Edited October 23, 2016 by raynner 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