----------------------------
-- CakeScript (March 29, 2008)
-- by LuaBanana
--
-- Alpha Version
-- concmd.lua
----------------------------

-- Restricts non-superadmins from equipping SWEPs
function NoSweps(ply, cmd, args)

	if(ply:IsSuperAdmin() or ply:IsAdmin()) then
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] gave themself " .. args[1]);
		ply:Give(args[1]); 
	else
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] attempted to give themself " .. args[1]);
		return false;
	end
	
end
concommand.Add("gm_giveswep", NoSweps);

-- Set Job
function ccSetJob(ply, cmd, args)

	local job = CAKE.CombineCCArgs(args);
	
	if(string.len(job) > 33) then
	
		CAKE.Notify(ply, "Job title is too long! Max 32 characters");
		return;
		
	end
	
	ply:SetField("info.job", job);
	return;
	
end
concommand.Add("rp_job", ccSetJob);

-- Change Name
function ccChangeName(ply, cmd, args)

	CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] changed name from " .. ply:Nick() .. " to " .. CAKE.CombineCCArgs(args));
	
	local name = CAKE.CombineCCArgs(args);
	ply:SetField("rpname", name);
	
end
concommand.Add("rp_changename", ccChangeName);

-- Set Model
function ccSetModel(ply, cmd, args)

	local mdl = CAKE.CombineCCArgs(args);
	
	if(ply:GetNWInt("charactercreate") == 1) then
	
		if(table.HasValue(models, string.lower(mdl))) then
		
			CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] set model to " .. mdl);
			ply:SetModel(string.lower(mdl));
			ply:SetField("info.model", mdl);
			
		else
			CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] attempted to set model to " .. mdl .. " but failed");
			ply:SetModel("models/humans/group01/male_01.mdl");
			ply:SetField("info.model", "models/humans/group01/male_01.mdl");
			
		end
		
	end
	
	return;
end
concommand.Add("rp_setmodel", ccSetModel);

function ccForceModel(ply, cmd, args)
	
	CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] forced model to " .. mdl);
	ply:SetModel(args[1]);
	ply:Spawn();
	
	return;

end
concommand.Add("rp_forcemodel", ccForceModel);

-- Save Default Model
function ccDefaultModel(ply, cmd, args)

	if(ply:GetNWInt("charactercreate") == 1) then
	
		mdl = ply:GetModel();
	
		if(table.HasValue(models, string.lower(mdl))) then
		
			CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] set default model to " .. mdl);
			ply:SetField("defaultModel", mdl);
			
		else
			CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] attempted to set default model to " .. mdl .. " but failed");
			ply:SetField("defaultModel", "models/humans/group01/male_01.mdl");
			
		end
		
	end
	
	return;
end
concommand.Add("rp_defaultmodel", ccDefaultModel);


-- Set Character Stats
function ccSetStats(ply, cmd, args)

	if( ply:GetNWInt("charactercreate") == 1 ) then
	
		-- valid ranges will be 0 to 100
		-- they act as bonuses, not as a base.
		ply:SetNWFloat("stats.str", 0); -- strength
		ply:SetNWFloat("stats.spd", 0); -- speed
		ply:SetNWFloat("stats.end", 0); -- endurance
		ply:SetNWFloat("stats.vit", 0); -- vitality
		
		-- ply:SetNWInt( "tiedup", 0 ); -- 1 tied up, 0 not tied up
		-- ply:SetNWInt( "beingtiedup", 0 ); -- 1 being tied up, 0 nothing, -1 being untied
		-- ply:SetNWInt( "Admin", 0 ); -- dun remember why this is here.
		-- ply:SetNWInt( "tyingup", 0 );
	
	end
	
	return;

end
concommand.Add("rp_setstats", ccSetStats);

-- Start Creation
function ccStartCreate(ply, cmd, args)
	
	CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] starting to create character");

	if( CharTable[ply:FormatSteamID()] == nil ) then
		CharTable[ply:FormatSteamID()] = {};
	end

	local PlyCharTable = CharTable[ply:FormatSteamID()]
	
	-- Find the highest Unique ID
	local high = 0;
	
	for k, v in pairs(PlyCharTable) do
	
		k = tonumber(k);
		high = tonumber(high);
		
		if( k != nil && k > high) then 
		
			high = k;
			
		end
		
	end
	
	high = high + 1;
	ply:SetNWString("uid", tostring(high));
	
	ply:SetNWInt("charactercreate", 1);
	CharTable[ply:FormatSteamID()][ply:GetNWInt("uid")] = {}
	
end
concommand.Add("rp_startcreate", ccStartCreate);

-- Finish Creation
function ccFinishCreate(ply, cmd, args)

	if(ply:GetNWInt("charactercreate") == 1) then
	
		--local cid = math.random(1,9) .. math.random(0,9) .. math.random(0,9) .. math.random(0,9) .. math.random(0,9) .. math.random(0,9) .. math.random(0,9) .. math.random(0,9) .. math.random(0,9) .. math.random(0,9);
		--ply:SetField("info.cid", cid); -- For now, randomly generate a 10 digit CID
		
		ply:SetNWInt("charactercreate", 0)
		
		-- Default the flags that are allowed
		ply:SetField("flags", {}, true)
		
		-- Set the player's default money
		ply:SetField("money", 150);
		
		-- Set their default inventory
		ply:SetField("inventory", {"small_medikit", "watermelon", "cyanide"}, true);
		ply:RefreshInventory()
		ply:RefreshBusiness()
		
		-- You don't START with tooltrust, silleh.
		ply:SetAccField("tooltrust", 0);
		
		ply:SetTeam(1);
		
		ply:SetField("info.job", "...");
		
		ply:Spawn();
		
--		ply:ConCommand("fadein");
		
--		ply:SetField("defaultModel", ply:GetModel() );
		
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] has finished creating character");
	end
	
end
concommand.Add("rp_finishcreate", ccFinishCreate);

function ccSelectChar(ply, cmd, args)

	local uid = args[1];
	
	if(CharTable[ply:FormatSteamID()][uid] != nil) then
	
		ply:SetNWString("uid", uid);
		
		for k, v in pairs(CharTable[ply:FormatSteamID()][uid]) do
		
			if(type(v) != "table") then
			
				ply:SetNWString(k, v);
				
			end
			
		end
		
		-- Kind of hacky method to allow us to keep a default model on selection spawn.
		ply:SetNWString("info.model", ply:GetNWString("defaultModel"));
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] selected character " .. uid);
	else
		
	end
	
	ply:SetNWInt("charactercreate", 0);
	
	ply:SetTeam(1);
	
	ply:RefreshInventory()
	ply:RefreshBusiness()
	
--	ply:ConCommand("fadein");
	ply:Spawn();
	
end
concommand.Add("rp_selectchar", ccSelectChar);
--[[
function ccAcceptDeath(ply, cmd, args)

	CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] accepted death");
	ply.deathtime = 120;
	
end
concommand.Add("rp_acceptdeath", ccAcceptDeath);
concommand.Add("rp_ad", ccAcceptDeath);
]]--
function ccInitPlayerMenu(ply, cmd, args)

	if(CharTable[ply:FormatSteamID()] == nil) then
	
		CharTable[ply:FormatSteamID()] = {}
		
	end
	
	local PlyCharTable = CharTable[ply:FormatSteamID()]
	
	-- Find the highest Unique ID
	local high = 0;
	
	for k, v in pairs(PlyCharTable) do if(tonumber(k) > tonumber(high)) then high = tonumber(k); end end
	
	local high = high + 1;
	
	ply:SetNWString("uid", tostring(high));
	
	ply:SetNWInt("charactercreate", 1)

	for k, v in pairs(PlyCharTable) do
		
		umsg.Start("ReceiveChar", ply);
			umsg.Long(k);
			umsg.String(v["rpname"]);
			umsg.String(v["info.model"]);
		umsg.End();
		
	end
	
end
concommand.Add("rp_playermenu", ccInitPlayerMenu);

function ccFlag(ply, cmd, args)
	
	local FlagTo = "";
	
	for k, v in pairs(Teams) do
		if(v["FlagKey"] == args[1]) then
			FlagTo = v;
			FlagTo.n = k;
			break;
		end
	end
	
	if(FlagTo == "") then
		CAKE.Notify(ply, "Incorrect Flag!");
		return;
	end

	if((ply:GetField("flags") != nil and table.HasValue(ply:GetField("flags"), args[1])) or FlagTo["public"]) then
		
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] flagged to " .. args[1]);
		ply:SetTeam(FlagTo.n);
		ply:Spawn();
		return;
				
	else
	
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] attempted to flag to " .. args[1] .. " but failed");
		CAKE.Notify(ply, "You do not have this flag!");
		
	end		
	
end
concommand.Add("rp_flag", ccFlag);

function ccEquip(ply, cmd, args)

	-- FUCK YOU FRONK FOR NOT WORKING!
	ply:StripWeapons();
	GAMEMODE:PlayerLoadout(ply);

	CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] used equip");
	
end
concommand.Add("rp_equip", ccEquip);

function ccLoadout( ply, cmd, args)
if( args[1] == "Assault" ) then
	--ply:ConCommand( "rp_flag mi" )
	ply:SetTeam(2)
	ply:Give( "weapon_assault_1" )
	ply:Give( "weapon_sidearm_1" )
	ply:GiveAmmo( 200, "smg1" )
	ply:GiveAmmo( 200, "pistol" )
	ply:SetArmor( 200 )
	local model11 = string.lower(ply:GetModel())
	model11 = string.gsub( model11, "humans/group01", "mobileinfantry" )
	model11 = string.gsub( model11, "humans/group02", "mobileinfantry" )
	model11 = string.gsub( model11, "humans/group03", "mobileinfantry" )
	model11 = string.gsub( model11, "female", "fmi" )
	model11 = string.gsub( model11, "male", "mi" )
	Msg(model11)
	ply:SetModel( model11 )
end

if( args[1] == "Support" and table.HasValue(ply:GetField("flags"), "S" )) then
	--ply:ConCommand( "rp_flag mi" )
	ply:Give( "weapon_support_1" )
	ply:Give( "weapon_sidearm_1" )
	ply:GiveAmmo( 200, "ar2" )
	ply:Give( "weapon_frag" )
	ply:GiveAmmo( 3, "grenade" )
	ply:SetArmor( 200 )
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("supplykit")
	ply:GiveItem("medium_medikit")
	local model111 = string.lower(ply:GetModel())
	model111 = string.gsub( model111, "humans/group01", "mobileinfantry" )
	model111 = string.gsub( model111, "humans/group02", "mobileinfantry" )
	model111 = string.gsub( model111, "humans/group03", "mobileinfantry" )
	model111 = string.gsub( model111, "female", "fmi" )
	model111 = string.gsub( model111, "male", "mi" )
	ply:SetModel( model111 )
end

if( args[1] == "Reconnaissance" and table.HasValue(ply:GetField("flags"), "R" )) then
	ply:Give( "weapon_smg_1" )
	ply:Give( "weapon_sidearm_1" )
	--ply:ConCommand( "rp_job Mobile Intel. Operative" )
	ply:GiveAmmo( 200, "smg1" )
	ply:SetArmor(200)
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("supplykit")
	ply:GiveItem("medium_medikit")
	local model1111 = string.lower(ply:GetModel())
	model1111 = string.gsub( model1111, "humans/group01", "mobileinfantry" )
	model1111 = string.gsub( model1111, "humans/group02", "mobileinfantry" )
	model1111 = string.gsub( model1111, "humans/group03", "mobileinfantry" )
	model1111 = string.gsub( model1111, "female", "fmi" )
	model1111 = string.gsub( model1111, "male", "mi" )
	ply:SetModel( model1111 )
end
if( args[1] == "Medic" and table.HasValue(ply:GetField("flags"), "M" ) ) then
	ply:Give("weapon_smg_1" )
	ply:Give("weapon_medical")
	ply:GiveAmmo( 200, "smg1" )
	ply:SetArmor(200)
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("supplykit")
	ply:GiveItem("medium_medikit")
	local model = string.lower(ply:GetModel())
	model = string.gsub( model, "humans/group", "mobileinfantry" )
	model = string.gsub( model, "01", "" )
	model = string.gsub( model, "02", "" )
	model = string.gsub( model, "03", "" )
	model = string.gsub( model, "female", "fmi_m" )
	model = string.gsub( model, "male", "mi_m" )
	ply:SetModel( model )
end

if( args[1] == "Engineer" and table.HasValue(ply:GetField("flags"), "C" ) ) then
	ply:Give("federation_shotgun" )
	ply:Give("weapon_physgun")
	ply:Give("blowtorch")
	ply:GiveAmmo( 200, "buckshot" )
	ply:SetArmor(200)
	ply:GiveItem("ammo_shotgun")
	ply:GiveItem("supplykit")
	ply:GiveItem("medium_medikit")
	local model = string.lower(ply:GetModel())
	model = string.gsub( model, "humans/group", "mobileinfantry" )
	model = string.gsub( model, "01", "" )
	model = string.gsub( model, "02", "" )
	model = string.gsub( model, "03", "" )
	model = string.gsub( model, "female", "fmi_m" )
	model = string.gsub( model, "male", "mi_m" )
	ply:SetModel( model )
end
if( args[1] == "Mspec" and table.HasValue(ply:GetField("flags"), "Mspec" ) ) then
	--CAKE.Notify(ply, "jesus tits an MSPEC")
	ply:Give("federation_ssmg")
	ply:Give("federation_sniper")
	ply:Give("federation_gl")
	ply:Give("federation_MGMK2")
	ply:GiveAmmo(800, "SMG1")
	ply:GiveItem("large_medikit")
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("ammo_shotgun")
	ply:GiveItem("ammo_shotgun")
	ply:GiveItem("supplykit")
	ply:GiveItem("supplykit")
	ply:GiveItem("supplykit")
	ply:GiveItem("supplykit")
	ply:SetArmor(250)
	ply:SetHealth(250)
	ply:SetModel("models/thespectator/od.mdl")
end
if( args[1] == "RAF" and table.HasValue(ply:GetField("flags"), "RAF" ) ) then
	--CAKE.Notify(ply, "jesus tits an MSPEC")
	ply:Give("federation_ssmg")
	ply:Give("federation_sniper")
	ply:GiveAmmo(400, "SMG1")
	ply:GiveItem("large_medikit")
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("ammo_rifle")
	ply:GiveItem("supplykit")
	ply:SetModel("models/thespectator/od.mdl")
end
if( args[1] == "Support" and not table.HasValue(ply:GetField("flags"), "S" )) then
	CAKE.Notify(ply, "Unqualified for Support Loadout.")
	ply:ConCommand("rp_flag citizen")
end
if( args[1] == "Medic" and not table.HasValue(ply:GetField("flags"), "M" )) then
	CAKE.Notify(ply, "Unqualified for Medical Duty.")
	ply:ConCommand("rp_flag citizen")
end
if( args[1] == "Reconnaissance" and not table.HasValue(ply:GetField("flags"), "R" )) then
	CAKE.Notify(ply, "Unqualified for Reconnaissance Loadout.")
	ply:ConCommand("rp_flag citizen")
end
if( args[1] == "Engineer" and not table.HasValue(ply:GetField("flags"), "C" )) then
	CAKE.Notify(ply, "Unqualified for Engineer Duty.")	
	ply:ConCommand("rp_flag citizen")
end

if( args[1] == "Mspec" and not table.HasValue(ply:GetField("flags"), "Mspec" )) then
	CAKE.Notify(ply, "Restricted Access - go away.")
	ply:ConCommand("rp_flag citizen")
end
end
concommand.Add("rp_loadout", ccLoadout)

function ccDropWeapon(ply, cmd, args)
	
	local wep = ply:GetActiveWeapon()
	
	if(ItemData[wep:GetClass()] == nil) then CAKE.Notify(ply, "This weapon cannot be dropped!"); return; end
	
	ply:StripWeapon(wep:GetClass());
	
	ply:SelectWeapon("hands");
	
	CAKE.CreateItem(wep:GetClass(), ply:CalcDrop(), Angle(0,0,0));
	
	CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] dropped weapon " .. wep:GetClass());

end
concommand.Add("rp_dropweapon", ccDropWeapon);

function ccPickupItem(ply, cmd, args)
	
	local item = ents.GetByIndex(tonumber(args[1]));
	
	if(item != nil and item:IsValid() and item:GetClass() == "item_prop" and item:GetPos():Distance(ply:GetShootPos()) < 100) then
		
		item:Pickup(ply);
		ply:GiveItem(item.Class);
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] picked up item " .. item.Class);
		
	end

end
concommand.Add("rp_pickup", ccPickupItem);
--[[
function ccGetFlags(ply, cmd, args)

local flagtable = ply:GetField("flags");
	if(table.HasValue(flagtable1, "mi")) then
		CAKE.Notify(ply, " You have the mi flag, qualified for mobile infantry.")
	end
	if(table.HasValue(flagtable1, "E")) then
		CAKE.Notify(ply, " You have the E flag, you can qualify infantryman, and process recruits.")
	end
	if(table.HasValue(flagtable1, "M")) then
		CAKE.Notify(ply, " You have the M qualification, you are able to heal infantryman on the battlefield")
	end
	if(table.HasValue(flagtable1, "S")) then
		CAKE.Notify(ply, " You have the S qualification, you are able to use the Heavy MG to suppress targets")
	end
	if(table.HasValue(flagtable1, "C")) then
		CAKE.Notify(ply, " You have the C qualification, you are able to build things on the battlefield.")
	end
	if(table.HasValue(flagtable1, "R")) then
		CAKE.Notify(ply, " You have the R qualification, you are able to scout out areas and report on rogue units.")
	end
end
concommand.Add("rp_myflags", ccGetFlags)
]]--

function ccUseItem(ply, cmd, args)
	
	local item = ents.GetByIndex(tonumber(args[1]));
	
	if(item != nil and item:IsValid() and item:GetClass() == "item_prop" and item:GetPos():Distance(ply:GetShootPos()) < 100) then
		item:UseItem(ply);
		CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] used item " .. item.Class);
	end

end
concommand.Add("rp_useitem", ccUseItem);

function ccGiveMoney(ply, cmd, args)
	
	if(player.GetByID(args[1]) != nil) then
		local target = player.GetByID(args[1]);
		
		if(tonumber(args[2]) > 0) then
			if(tonumber(ply:GetField("money")) >= tonumber(args[2])) then
				target:SetField("money", target:GetField("money") + args[2]);
				ply:SetField("money", ply:GetField("money") - args[2]);
				CAKE.Notify(ply, "You gave " .. target:Nick() .. " " .. args[2] .. " credits!");
				CAKE.Notify(target, ply:Nick() .. " gave you " .. args[2] .. " credits!");
				CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] gave " .. target:Name() .. " [" .. target:SteamID() .. "] " .. args[2] .. " credits");
			else
				CAKE.Notify(ply, "You do not have that many tokens!");
			end
		else
			CAKE.Notify(ply, "Invalid amount of money!");
		end
	else
		CAKE.Notify(ply, "Target not found!");
	end
	
end
concommand.Add("rp_givemoney", ccGiveMoney);	

function ccOpenChat(ply, cmd, args)

	ply:SetNWInt("chatopen", 1)
	
end
concommand.Add("rp_openedchat", ccOpenChat);

function ccCloseChat(ply, cmd, args)

	ply:SetNWInt("chatopen", 0)
	
end
concommand.Add("rp_closedchat", ccCloseChat);

function ccTieUp( ply, cmd, args )
	
	-- tie up
	if( args[1] == 1 ) then
	
		ply:SetNWInt("tiedup",1);
		ply:SetNWInt("beingtiedup",0);
		ply:SelectWeapon("hands");
	
	-- untie
	elseif( args[1] == -1 ) then
	
		ply:SetNWInt("tiedup",0);
		ply:SetNWInt("beingtiedup",0);
	
	end

end
concommand.Add("rp_tieUp", ccTieUp);

function ccToolTrustTrace( ply )

	if(ply:GetAccField("tooltrust") == 1) then
		CAKE.Notify( ply, "Test1: You have tooltrust");
	else
		CAKE.Notify( ply, "Test1: You dont have tooltrust");
	end

	if(ply:GetAccField("tooltrust") == "1") then
		CAKE.Notify( ply, "Test2: You have tooltrust");
	else
		CAKE.Notify( ply, "Test2: You dont have tooltrust");
	end
	
	CAKE.Notify( ply, "Your TT value is: " .. (ply:GetAccField("tooltrust")));
	
end
concommand.Add("rp_checktt", ccToolTrustTrace);

local function sendClientInfo(ply, cmd, args)

	local PlyCharTable = CharTable[ply:FormatSteamID()];
	
	if( PlyCharTable == nil ) then
	
		CAKE.LoadPlayerDataFile( ply );
		sendClientInfo(ply, cmd, args);
		return;
		
	end
	
	-- Find the highest Unique ID
	local high = 0;
	
	for k, v in pairs(PlyCharTable) do
	
		k = tonumber(k);
		high = tonumber(high);
		
		if( k != nil and k > high) then 
		
			high = k;
			
		end
		
	end
	
	high = high + 1;
	ply:SetNWString("uid", tostring(high));
	
	ply:SetNWInt("charactercreate", 1)
	ply:SetNWString("steamid", ply:SteamID());

	for k, v in pairs(PlyCharTable) do
	
		if ( tonumber(k) != nil ) then
		
			umsg.Start("ReceiveChar", ply);
				umsg.Long(k);
				umsg.String(v["rpname"]);
				umsg.String(v["info.model"]);
			umsg.End();
		else
		
		end
		
	end
	
	--local function delayed_umsg()
	umsg.Start("charactercreate", ply);
	umsg.End();
	--end

end
concommand.Add("clientIsReadyForSetup", sendClientInfo);

function emergencyReloadCall( ply, cmd, args )

	--GM:PlayerInitialSpawn(ply);

	CAKE.DayLog(ply:Name() .. " [" .. ply:SteamID() .. "] used an emergency reload.");
	for k, v in pairs(models) do
		umsg.Start("addmodel", ply);
		
			umsg.String(v);
			
		umsg.End();
	end
	
	ply:SetNWInt("chatopen", 0);
	
	CAKE.InitTeams(ply);
	
	if(table.HasValue(SuperAdmins, ply:SteamID())) then ply:SetUserGroup("superadmin"); end
	if(table.HasValue(Admins, ply:SteamID())) then ply:SetUserGroup("admin"); end
	
	CAKE.LoadPlayerDataFile( ply );
	
	ply.LastOOC = 0;
	
	sendClientInfo(ply, cmd, args);

end
concommand.Add("emergencyFullReloadCommandIsLong", emergencyReloadCall );


local function setRadioStation( ply, cmd, args )

	if( args[1] == nil ) then
		return;
	end

	local station = tonumber( args[1] );
	if( station == nil ) then
	
		CAKE.Notify( ply, "The channel must contain only number values." );
		return;
	
	end
	
	-- We reserve 0 for simplicities sake, uninitialized people will return 0 when asked this field
	if( station == 0 ) then
	
		CAKE.Notify( ply, "The channel cannot be 0.");
		return;
	
	end
	
	ply:SetNWFloat("radioChannel", station);

end
concommand.Add("rp_setRadio", setRadioStation );

-- we use it opposite because of default settings
-- 0 = regen enabled
-- anything else = no regen enabled
local function setRegenOption( ply, cmd, args )

	if( args[1] == nil ) then
		return;
	end
	
	if( args[1] == "0" ) then
		ply:SetNWInt("healthRegen", 1);
	else
		ply:SetNWInt("healthRegen", 0);
	end

end
concommand.Add("rp_setRegen", setRegenOption );