addhook("buildattempt","Fastbuild_mod")
function Fastbuild_mod(id,t,x,y,m)
	if SERVER_DATA["fastbuild"] then
		if t >= 1 and t <= 15 then
			parse("spawnobject "..t.." "..x.." "..y.." "..player(id,"rot").." "..m.." "..player(id,"team").." "..id)
			return 1
		end
	end
end

function SpawnObject(t,x,y,rot,mode,team,p)
	local ol = object(0,"table")
	rot = tonumber(rot) or 0
	mode = tonumber(mode) or 0
	team = tonumber(team) or 0
	p = tonumber(p) or 0
	parse("spawnobject "..t.." "..x.." "..y.." "..rot.." "..mode.." "..team.." "..p)
	
	local ol2 = object(0,"table")
	for k, v in pairs(ol2) do
		if not ol[k] or ol[k] ~= v then
			return v
		end
	end
end

function FastbuildButton()
	if SERVER_DATA["fastbuild"] then
		return "Fast build|Enabled"
	end
	return "Fast build|Disabled"
end

function FastbuildToggle()
	if SERVER_DATA["fastbuild"] then
		SERVER_DATA["fastbuild"] = nil
		msg("fast build DISABLED@C")
	else
		SERVER_DATA["fastbuild"] = true
		msg("fast build ENABLED@C")
	end
end

CreateSetting(FastbuildButton, FastbuildToggle)