Carbonik Posted May 29, 2010 Share Posted May 29, 2010 (edited) I tried about 3 or 4 hours, but nothing. Someone help me? I tried: function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playermoney = getPlayerMoney ( source ) setAccountData ( playeraccount, "funmodev2-money", playermoney ) end end local root = getRootElement() addEventHandler("onPlayerLogin", root, function() local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "funmodev2-money" ) if ( playermoney ) then setPlayerMoney ( source, playermoney ) end end end ) addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) local playercash = getPlayerMoney ( player ) function addColumns() exports.dxscoreboard:scoreboardAddColumn("$Money") points () end addEventHandler("onResourceStart",getRootElement(),addColumns) function points () setElementData ( player, "$Money", playercash ) end but does not work Edited May 29, 2010 by Guest Link to comment
dzek (varez) Posted May 29, 2010 Share Posted May 29, 2010 add column then every for example 5 seconds loop through all players, get their money, and setElementData to them. Link to comment
Carbonik Posted May 29, 2010 Author Share Posted May 29, 2010 how it should look like? Link to comment
Castillo Posted May 30, 2010 Share Posted May 30, 2010 how it should look like? client: local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"money",getPlayerMoney(player) ) counter = 0 starttick = false end end server: addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName("scoreboard"),"addScoreboardColumn","money") end ) Link to comment
karlis Posted May 30, 2010 Share Posted May 30, 2010 how it should look like? local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"money",getPlayerMoney(player) ) counter = 0 starttick = false end end senseless.just use setTimer(function() setElementData(player,"money",getPlayerMoney(player) end, 0, 5000 ) Link to comment
Carbonik Posted May 30, 2010 Author Share Posted May 30, 2010 ok, in meta i wrote: <meta> <info author="Carbonik" type="script" version="1.0" name="money_dx" description="Adds money on dxscoreboard"/> <script src="money.lua" type="client"/> <script src="table.lua" type="server"/> </meta> money.lua: local root = getRootElement() local player = getLocalPlayer() local counter = 0 local starttick local currenttick addEventHandler("onClientRender",root, function() if not starttick then starttick = getTickCount() end counter = counter + 1 currenttick = getTickCount() if currenttick - starttick >= 1000 then setElementData(player,"money",getPlayerMoney(player) ) counter = 0 starttick = false end end setTimer(function() setElementData(player,"money",getPlayerMoney(player) end, 0, 5000 ) and table.lua: addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() call(getResourceFromName("dxscoreboard"),"addScoreboardColumn","money") end ) and it does not work : Link to comment
Castillo Posted May 30, 2010 Share Posted May 30, 2010 lol just copy and paste my code in a client.lua and a server.lua cause karlis is meaning other thing. Link to comment
Carbonik Posted May 30, 2010 Author Share Posted May 30, 2010 but, this dont work,please make for me the correct script in debugscript 3 i see error, but i dont know what is this..: Link to comment
karlis Posted May 30, 2010 Share Posted May 30, 2010 remove the onClientRender event, just set the timer when resource starts Link to comment
Carbonik Posted May 31, 2010 Author Share Posted May 31, 2010 but how?, sorry I'm a rookie ;/ Link to comment
karlis Posted May 31, 2010 Share Posted May 31, 2010 1)use [ lua] [/lua] tags 2)rename dxscorebaord resource to "scoreboard", due to fact all resources supports that name 3)only table.lua needed local root = getRootElement() addEventHandler("onResourceStart",getResourceRootElement(), function() exports.scoreboard:addScoreboardColumn("money") setTimer( function() for _,player in ipairs(getElementsByType("player")) do setElementData(player,"money",getPlayerMoney(player)) end end, 0, 5000) end ) 4)don't get money clientside as then money is hackable Link to comment
Carbonik Posted May 31, 2010 Author Share Posted May 31, 2010 scoreboard working, but money not Link to comment
artek Posted June 1, 2010 Share Posted June 1, 2010 this shit is easy keep trying, can you succeed 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