Giving players an entity script

There is a command in ULX that can be used to give an entity. !give {player} {entity}
I tried to edit so that when the player types !{command} it will give the caller the entity but I am so inexperienced in this I really don’t know what I am doing…and it’s not working. Can someone please help me out?


function ulx.bubblegun( calling_ply )

	if ( not ply:Alive() or ply:IsSpec () ) then -- Is the player dead?

			ULib.tsayError( ply, "You are dead!", true )

		elseif ply:IsFrozen() then -- Is the player frozen?

			ULib.tsayError( ply, "You are frozen!", true )

		else 

			LocalPlayer():Give( "bubblegun" )
			
		end
		
		ulx.fancyLogAdmin( calling_ply, "#A gave #T #s", calling_ply, entity )
		
end


local bubblegun = ulx.command( "Custom", "ulx bubblegun", ulx.bubblegun, "!bubblegun" )
local bubblegun = ulx.command( "Custom", "ulx bubblegun", ulx.bubblegun, "/bubblegun" )
bubblegun:defaultAccess( ULib.ACCESS_ADMIN )
bubblegun:help( "Get the bubblegun!" )

Here is the original:


function ulx.give( calling_ply, target_plys, entity, should_silent )

	for k,v in pairs( target_plys ) do

		if ( not v:Alive() ) then -- Is the player dead?
	
			ULib.tsayError( calling_ply, v:Nick() .. " is dead!", true )
	
		elseif v:IsFrozen() then -- Is the player frozen?
	
			ULib.tsayError( calling_ply, v:Nick() .. " is frozen!", true )
	
		elseif v:InVehicle() then -- Is the player in a vehicle?
	
			ULib.tsayError( calling_ply, v:Nick() .. " is in a vehicle.", true )
		
		else 
	
			v:Give( entity )
			
		end
		
	end
	
	if should_silent then
	
		ulx.fancyLogAdmin( calling_ply, true, "#A gave #T #s", target_plys, entity )
		
	else
	
		ulx.fancyLogAdmin( calling_ply, "#A gave #T #s", target_plys, entity )
	
	end

end
local give = ulx.command( "Custom", "ulx give", ulx.give, "!give" )
give:addParam{ type=ULib.cmds.PlayersArg }
give:addParam{ type=ULib.cmds.StringArg, hint="entity" }
give:addParam{ type=ULib.cmds.BoolArg, invisible=true }
give:defaultAccess( ULib.ACCESS_ADMIN )
give:help( "Give a player an entity" )
give:setOpposite ( "ulx sgive", { _, _, _, true }, "!sgive", true )


function ulx.bubblegun( ply )

	if ( not ply:Alive() or ply:IsSpec () ) then -- Is the player dead?

			ULib.tsayError( ply, "You are dead!", true )

		elseif ply:IsFrozen() then -- Is the player frozen?

			ULib.tsayError( ply, "You are frozen!", true )

		else 

			ply:Give( "bubblegun" )
			
		end
		
		ulx.fancyLogAdmin( ply, "#A himself a bubblegun" )
		
end


local bubblegun = ulx.command( "Custom", "ulx bubblegun", ulx.bubblegun, "!bubblegun" )
local bubblegun = ulx.command( "Custom", "ulx bubblegun", ulx.bubblegun, "/bubblegun" )
bubblegun:defaultAccess( ULib.ACCESS_ADMIN )
bubblegun:help( "Get the bubblegun!" )

Thank you very much dude. That really helps out!