View Single Post
Old 02-03-2009, 07:21 PM   #11
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Code:
flag_button_common = func_button:new({ team = Team.kUnassigned, flagname = "default_flag_name" }) 

function flag_button_common:allowed( allowed_entity ) 
	if IsPlayer( allowed_entity ) then
		local player = CastToPlayer( allowed_entity )
		-- if player is on the correct team
		if player:GetTeamId() == self.team then
			-- if flag is at its spawn point
			if _G[self.flagname].status == 0 then
				return EVENT_ALLOWED
			end
		end
	end
	return EVENT_DISALLOWED
end

-- if not allowed
function flag_button_common:onfailuse( use_entity )
	if IsPlayer( use_entity ) then
		local player = CastToPlayer( use_entity )
		BroadCastMessageToPlayer( player, "#FF_NOTALLOWEDBUTTON" )
	end
end

red_flag_button = flag_button_common:new({ team = Team.kRed, flagname = "flag_name" }) 
blue_flag_button = flag_button_common:new({ team = Team.kBlue, flagname = "flag_name" })
Hopefully that works for you.
__________________
#FF.Pickup ยค Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote