So recently Ive gotten back into coding, and my mind is pulling blanks on how to do this.
With the code below, I have the list which shows all the currently connected players and their amount of cash.(this is for an admin panel btw)
The admin places the amount of cash that is to be set in the amount tab(text box) after he/she enters the amount and presses the ex: “Give” button, it will give the players that amount of money on top of what they had.
How Can I get the amount the admin entered to be sent to the selected players money?
Below I have 2 .lua files I am using, money.lua and cl_init.lua
cl_init.lua(the admin panel portion)
list:SetParent(frame) list:SetPos(10, 35) list:SetSize( 300, 150) list:SetMultiSelect(false) list:AddColumn("Player") list:AddColumn("Money") for k,v in pairs(player.GetAll()) do list:AddLine(v:Nick(),v:GetNWInt( "cash" )) end amount:SetPos( 275, 220 ) amount:SetTall( 20 ) amount:SetWide( 50 ) amount:SetEnterAllowed(true) give:SetPos( 25, 220 ) give:SetSize( 40, 20 ) give:SetText( "Give" ) give.DoClick = function( ply ) print(amount:GetValue(), list:GetSelectedLine()) end set:SetPos( 75, 220 ) set:SetSize( 40, 20 ) set:SetText( "Set" ) set.DoClick = function() print(amount:GetValue(), list:GetSelectedLine()) end
money.lua(the Money_Add portion)
function pm:Money_Add( cash ) if cash > 0 then local current = tonumber(self:GetPData( "cash" )) self:Money_Set( current + cash ) end end
If there is anything else you need to assist me please let me know, I am very eager to get this workin.