GMOD Paid Armor Addon


if not SERVER then return end

hook.Add( "PlayerSay", "CommandIdent", function( ply, text ) )
	if( text == "/armor" ) then
	
		if( ply:DarkRP:GetBalance !== "10000" ) then end
		
		else
		
		function TakeCash( ply, amount )
		ply:AddMoney(-10000)
		end
		
		ply:SetArmor( 255 )
		
		end
		end

So I have this as my code. I know the get balance is wrong, but I couldn’t find online how to check the balance. Also when I do find out it will only work if the person has exactly 10k how would I make it 10k and up.

Why are you declaring a function inside of the hook? You should just be running the functions. Also, I’m pretty sure the function is getMoney

That would be ‘>=’, this’ll get you on the right path:



if (text == "/armor" and (ply:getDarkRPVar("money") >= 1000)) then
    ply:addMoney(-1000);
    ply:SetArmor(255);
end


Also, I would do text:lower() to make the command case-insensitive.