• Simple DarkRP Request
    8 replies, posted
Recently my Build RP server (running DarkRP) has become victim of the hacked money glitch. I need a way of checking how much money everyone currently in the server has so I can call out who has hacked money. I request the ability to call a console command (such as rp_showmoney) and have the command print out players' money. ex. rp_showmoney Zwolf11 - $9001 GuyNumberTwo - $7890 PoorHobo - $0 Any help would be appreciated.
[lua] concommand.Add( "rp_showmoney", function() for k, v in pairs( player.GetAll() ) do if ValidEntity( v ) then Money = v.DarkRPVars.money print( v:Nick() .. " - $" .. Money ) end end end ) [/lua]
[QUOTE=Fisheater;25984270][lua] concommand.Add( "rp_showmoney", function() for k, v in pairs( player.GetAll() ) do if ValidEntity( v ) then Money = v.DarkRPVars.money print( v:Nick() .. " - $" .. Money ) end end end [/lua][/QUOTE] Awesome! The only problem is that I'm completely retarded and apparently don't know where to put it. I tacked it on the end of main.lua in the gamemode folder but when I tried to run it in game it returned "command uknown". So...yeah...haha. Rate dumb please.
[QUOTE=thejjokerr;25996973]He missed a ) at the end. Use this: [lua]concommand.Add( "rp_showmoney", function() for k, v in pairs( player.GetAll() ) do if ValidEntity( v ) then Money = v.DarkRPVars.money print( v:Nick() .. " - $" .. Money ); end; end; end);[/lua][/QUOTE] FUCK YEAR, it works! Thank you so much! Edit: Damn, it only works in single player. When I added it to my server the command runs but it doesn't return any results. However, in single player, it runs correctly then displays: Zwolf11 - $43939 just as it should.
[lua] concommand.Add( "rp_showmoney", function( ply, cmd, args ) for k, v in pairs( player.GetAll() ) do if ValidEntity( v ) then Money = v.DarkRPVars.money ply:PrintMessage(HUD_PRINTCONSOLE, v:Nick() .. " - $" .. Money ); end; end; end); [/lua]
PrintMessage*
[QUOTE=Marc0303;26000421][lua] concommand.Add( "rp_showmoney", function( ply, cmd, args ) for k, v in pairs( player.GetAll() ) do if ValidEntity( v ) then Money = v.DarkRPVars.money ply:PrintMessage(HUD_PRINTCONSOLE, v:Nick() .. " - $" .. Money ); end; end; end); [/lua][/QUOTE] awesome! it appears to be working, now to test it on the actual server... Edit: Awesome, it works! Thank you everyone who helped!
Sorry, you need to Log In to post a reply to this thread.