Quick bit of help on ending things.

Hi, just want to know how to end this loop before the else to stop else looping.Thanks for anyone that can help.



AddCSLuaFile( "shared.lua" )

include('shared.lua') -- At this point the contents of shared.lua are ran on the server only.

function ENT:Initialize( ) --This function is run when the entity is created so it's a good place to setup our entity.
	
	self:SetModel( "models/czeror/models/lab_microscope.mdl" ) -- Sets the model of the NPC.
	self:SetSolid( SOLID_VPHYSICS ) 
                self:SetCollisionGroup( COLLISION_GROUP_PLAYER )
	self:SetUseType( SIMPLE_USE )
end

function ENT:OnTakeDamage()
	return false
end 

function ENT:AcceptInput( Name, Activator, Caller )	

	if Name == "Use" and Caller:IsPlayer() then
		for id, ent in pairs( ents.FindInSphere( Caller:GetPos(), 160 ) ) do
		if ( ent:GetClass() == "xen_orange" )  then
		Caller:notify( "Starting crystal scan..." )
                                timer.Simple( 5, function() Caller:ChatPrint( "The crystal has been analysed the results are:" ) end )
                                timer.Simple( 5.3, function() Caller:ChatPrint( "Crystal Type: Coral Crystal" ) end )
                                timer.Simple( 5.6, function() Caller:ChatPrint( "Weight: " .. math.random( 40, 130 ) .. " kg" ) end )
                                timer.Simple( 5.9, function() Caller:ChatPrint( "Origin: Xen" ) end )

		elseif ( ent:GetClass() == "xen_yellow" )  then
		Caller:notify( "Starting crystal scan..." )
                                timer.Simple( 5, function() Caller:ChatPrint( "The crystal has been analysed the results are:" ) end )
                                timer.Simple( 5.3, function() Caller:ChatPrint( "Crystal Type: Jonquil Crystal" ) end )
                                timer.Simple( 5.6, function() Caller:ChatPrint( "Weight: " .. math.random( 100, 300 ) .. " kg" ) end )
                                timer.Simple( 5.9, function() Caller:ChatPrint( "Origin: ERROR" ) end )

		elseif ( ent:GetClass() == "xen_green" )  then
		Caller:notify( "Starting crystal scan..." )
                                timer.Simple( 5, function() Caller:ChatPrint( "The crystal has been analysed the results are:" ) end )
                                timer.Simple( 5.3, function() Caller:ChatPrint( "Crystal Type: Celadon Crystal" ) end )
                                timer.Simple( 5.6, function() Caller:ChatPrint( "Weight: " .. math.random( 40, 130 ) .. " kg" ) end )
                                timer.Simple( 5.9, function() Caller:ChatPrint( "Origin: Xen" ) end )

		elseif ( ent:GetClass() == "xen_violet" )  then
		Caller:notify( "Starting crystal scan..." )
                                timer.Simple( 5, function() Caller:ChatPrint( "The crystal has been analysed the results are:" ) end )
                                timer.Simple( 5.3, function() Caller:ChatPrint( "Crystal Type: Amethyst Crystal" ) end )
                                timer.Simple( 5.6, function() Caller:ChatPrint( "Weight: " .. math.random( 70, 90 ) .. " kg" ) end )
                                timer.Simple( 5.9, function() Caller:ChatPrint( "Origin: Xen" ) end )
end
else
		Caller:notify( "There is no crystal nearby." )
end

	end
	
end



Your else is for this if:

if Name == “Use” and Caller:IsPlayer() then

Indent your code properly and you would not need to ask stupid questions.

Thanks.